Skip to content

Instantly share code, notes, and snippets.

@kaplas
Created May 14, 2013 17:18
Show Gist options
  • Save kaplas/5577735 to your computer and use it in GitHub Desktop.
Save kaplas/5577735 to your computer and use it in GitHub Desktop.
How to get Backbone, Underscore (with your own extensions) and RequireJS to work together.
// Use the version from Backbone AMD repository:
// https://github.com/amdjs/backbone
require.config({
paths:
{
underscore : 'libs/underscore-with-mixins',
jquery : 'libs/jquery',
backbone : 'libs/backbone-amd'
},
shim: {
'libs/underscore-original': {
exports: '_'
}
}
});
// Use the original Underscore.js file
define([
'libs/underscore-original'
], function (
_
) {
// Define your own Underscore mixins here
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment