Created
May 14, 2013 17:18
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use the version from Backbone AMD repository: | |
// https://github.com/amdjs/backbone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require.config({ | |
paths: | |
{ | |
underscore : 'libs/underscore-with-mixins', | |
jquery : 'libs/jquery', | |
backbone : 'libs/backbone-amd' | |
}, | |
shim: { | |
'libs/underscore-original': { | |
exports: '_' | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use the original Underscore.js file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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