Skip to content

Instantly share code, notes, and snippets.

@siroky
Created September 25, 2015 01:54
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 siroky/9429bab1bb825a81459c to your computer and use it in GitHub Desktop.
Save siroky/9429bab1bb825a81459c to your computer and use it in GitHub Desktop.
var context = require.context('./Scripts/Sources/', true, /^\.\/.*\.js$/);
var _ = require('underscore');
window.require = function (m, callback) {
if (_.isFunction(callback)) {
if (_.isArray(m)) {
callback(_.map(m, window.require));
} else {
callback(window.require(m));
}
} else {
return context('./' + m + '.js');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment