-
Notifications
You must be signed in to change notification settings - Fork 48
0.3.x addRule and Your Favorite Library
Jakob Heuser edited this page Jul 20, 2012
·
1 revision
If you have a library you'd like to use, here are some addRule lines that can make your favorite library CommonJS compliant.
require.addRule(/^jquery$/, {
path: "jquery.js",
pointcuts: {
after: function() {
module.setExports(jQuery.noConflict());
delete window["jQuery"];
}
}
});
require.addRule(/^modernizr$/i, {
path: "modernizr.js",
pointcuts: {
// before: localize window.document for sandbox
before: function() {
this.document = window.document;
},
// after: capture exports as object, delete from global scope
after: function () {
module.setExports(window.Modernizr);
delete window["Modernizr"];
}
}
});