Last active
December 11, 2015 16:39
-
-
Save caridy/4629575 to your computer and use it in GitHub Desktop.
This example demonstrate that YUI Loader on the server side will dynamically resolve dependencies, which means requirements do not need to be part of the meta set through `applyConfig`.
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
YUI.add('bar', function (Y, NAME) { | |
Y[NAME] = true; | |
console.log(NAME); | |
}, '', {requires: ['baz']}); |
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
YUI.add('baz', function (Y, NAME) { | |
Y[NAME] = true; | |
console.log(NAME); | |
}, '', {requires: ['foo']}); |
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
YUI.add('foo', function (Y, NAME) { | |
Y[NAME] = true; | |
console.log(NAME); | |
}, '', {requires: []}); |
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
var YUI = require('yui').YUI; | |
var Y = YUI({useSync: true}); | |
Y.applyConfig({ | |
groups: { | |
mojitOne: { | |
modules: { | |
foo: { | |
fullpath: __dirname + '/foo.js' | |
} | |
} | |
}, | |
mojitTwo: { | |
modules: { | |
bar: { | |
fullpath: __dirname + '/bar.js' | |
}, | |
baz: { | |
fullpath: __dirname + '/baz.js' | |
} | |
} | |
} | |
} | |
}); | |
Y.use('bar'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment