Skip to content

Instantly share code, notes, and snippets.

@davglass
Created August 13, 2012 18:41
Show Gist options
  • Save davglass/3343075 to your computer and use it in GitHub Desktop.
Save davglass/3343075 to your computer and use it in GitHub Desktop.
NodeJS Lang Modules
node_modules/ <-- npm i yui
mod/
moduleA/
moduleA.js
lang/
moduleA_en.js
test.js
$ ./test.js
ModuleA Strings: { foo: 'FOO', bar: 'BAR' }
callback
#!/usr/bin/env node
var YUI = require('yui').YUI,
path = require('path');
YUI({
lang: [ 'en' ],
groups: {
intl: {
base: path.join(__dirname, 'mod/'),
modules: {
moduleA: {
path: 'moduleA/moduleA.js',
lang: [ 'en' ],
requires: ['intl']
}
}
}
}
}).use('moduleA', function(Y) {
console.log('callback');
});
YUI.add('moduleA', function(Y) {
var strings = Y.Intl.get('moduleA');
console.log('ModuleA Strings: ', strings);
});
YUI.add('lang/moduleA_en', function(Y) {
Y.Intl.add("moduleA", "en", {
foo: 'FOO',
bar: 'BAR'
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment