Created
August 27, 2011 03:40
-
-
Save davglass/1174937 to your computer and use it in GitHub Desktop.
YUI Loader in Node without YUI
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
wget http://yui.yahooapis.com/3.4.0/build/yui/yui-min.js | |
mkdir vendor | |
wget http://documentcloud.github.com/backbone/backbone-min.js -O vendor/backbone.js | |
wget http://code.jquery.com/jquery-1.6.2.min.js -O vendor/jquery.js |
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
#!/usr/bin/env node | |
var Y = require('./yui-min').YUI(); | |
var loader = new Y.Loader({ | |
base: __dirname, | |
modules: { | |
jquery: { | |
path: '/vendor/jquery.js' | |
}, | |
backbone: { | |
path: '/vendor/backbone.js', | |
requires: [ 'jquery' ] | |
} | |
} | |
}); | |
loader.require('backbone'); | |
var out = loader.resolve(true); | |
console.log(out); |
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
$ ./loader.js | |
{ | |
js: | |
[ '/Users/davglass/src/loader/vendor/jquery.js', | |
'/Users/davglass/src/loader/vendor/backbone.js' ], | |
css: [] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment