Created
May 3, 2015 04:58
-
-
Save joshhunt/7433a7496aff505ccbbb to your computer and use it in GitHub Desktop.
Create loaders from a shim config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| makeLoaderFromShim = (toShim, fileName) -> | |
| _makeGlobalLoader = (toShim) -> "exports?#{toShim}" | |
| filenameRegex = new RegExp "^#{fileName}$" | |
| if _.isString toShim | |
| loader = _makeGlobalLoader toShim | |
| {test: filenameRegex, loader: loader} | |
| # Shortcut for creating loaders for shimming modules. | |
| # Key is file/module name | |
| # Value is variable to expose | |
| shim = { | |
| '3rdparty/swipe': 'Swipe' | |
| } | |
| extraLoaders = _.map shim, makeLoaderFromShim |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment