Skip to content

Instantly share code, notes, and snippets.

@jrburke
Created June 28, 2012 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrburke/3012544 to your computer and use it in GitHub Desktop.
Save jrburke/3012544 to your computer and use it in GitHub Desktop.
override print for r.js optimizer
var requirejs = require('requirejs'),
foo = require('foo');
requirejs.define('node/print', [], function () {
function print(msg) {
//Do whatever you want with the msg here.
//If you use node dependencies, can just require
//them outside of this closure.
foo(msg);
}
return print;
});
//Do the build.
requirejs.optimize({
//Usually requirejs.optimize() runs in "silent mode"
//when called in this way. Use logLevel to get the
//normal output out.
logLevel: 0
}, function () {
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment