Created
September 24, 2014 14:01
-
-
Save designeng/45504f810e2b99ad0943 to your computer and use it in GitHub Desktop.
requirejs hook for additiional file processing
This file contains 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
onBuildWrite: (moduleName, path, contents) -> | |
if path.match "/bower_components/" | |
pathFragments = path.split "/" | |
index = 0 | |
libName = undefined | |
for fragment in pathFragments | |
if fragment is "bower_components" | |
libName = pathFragments[index + 1] | |
console.log "libName::::", libName | |
break | |
else | |
index++ | |
contents = 'define(["another/id"], function () {});' | |
return contents |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Infrastructure modules can be filtered by this hook.
We can track which parts of the library was loaded (inserted into the page header, as variant) and so on.