Skip to content

Instantly share code, notes, and snippets.

@brandonminch
Created July 19, 2013 21:30
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 brandonminch/6042496 to your computer and use it in GitHub Desktop.
Save brandonminch/6042496 to your computer and use it in GitHub Desktop.
View loader for backbone views.
'loadViews': function (views, callback) {
var self = this,
viewPaths = _.map(views, function (view) {
return 'views/' + view;
});
require(viewPaths, function () {
var args = arguments;
_.each(args, function (view, i) {
self.views[views[i]] = args[i];
});
if (typeof callback === 'function') {
callback();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment