Skip to content

Instantly share code, notes, and snippets.

@caridy
Created June 23, 2011 15:38
Show Gist options
  • Save caridy/1042783 to your computer and use it in GitHub Desktop.
Save caridy/1042783 to your computer and use it in GitHub Desktop.
yui vs persistent Y
var http = require('http');
var YUI = require('yui3').YUI;
// persistent Y
var global_Y = YUI({
fetchCSS: false,
useConsoleOutput: false
});
http.createServer(function (req, res) {
if (req.url == '/yui') {
YUI({
fetchCSS: false,
useConsoleOutput: false
}).use('anim', 'datatype', 'event-valuechange', 'node-flick', 'resize', 'text', 'arraysort', 'console', 'dd', 'highlight', 'node-focusmanager', 'scrollview', 'transition', 'cookie', 'dial', 'history', 'node-menunav', 'uploader', 'async-queue', 'dom', 'oop', 'slider', 'widget', 'attribute', 'dump', 'imageloader', 'overlay', 'sortable', 'widget-anim', 'autocomplete', 'editor', 'intl', 'plugin', 'stylesheet', 'yql', 'base', 'io', 'pluginhost', 'substitute', 'cache', 'event', 'json', 'profiler', 'swf', 'charts', 'dataschema', 'event-custom', 'jsonp', 'querystring', 'swfdetect', 'classnamemanager', 'datasource', 'event-gestures', 'loader', 'queue-promote', 'collection', 'datatable', 'event-simulate', 'node', 'recordset', function(Y) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('\nBrand New YUI Instance\n');
});
}
else {
global_Y.use('anim', 'datatype', 'event-valuechange', 'node-flick', 'resize', 'text', 'arraysort', 'console', 'dd', 'highlight', 'node-focusmanager', 'scrollview', 'transition', 'cookie', 'dial', 'history', 'node-menunav', 'uploader', 'async-queue', 'dom', 'oop', 'slider', 'widget', 'attribute', 'dump', 'imageloader', 'overlay', 'sortable', 'widget-anim', 'autocomplete', 'editor', 'intl', 'plugin', 'stylesheet', 'yql', 'base', 'io', 'pluginhost', 'substitute', 'cache', 'event', 'json', 'profiler', 'swf', 'charts', 'dataschema', 'event-custom', 'jsonp', 'querystring', 'swfdetect', 'classnamemanager', 'datasource', 'event-gestures', 'loader', 'queue-promote', 'collection', 'datatable', 'event-simulate', 'node', 'recordset', function(Y) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('\nPersistent YUI Instance\n');
});
}
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment