Closed dminkovsky closed 10 years ago
Where do the strings backbone
and io
come from? Is that whatever the user chooses as the shim names? In order for this to work would the user have to shim in the same way you did? I'm not terribly familiar with RequireJS.
Hi @scttnlsn, thanks for looking and responding. Been sick, but looking forward to clarifying these points for you.
Thanks again, Dmitry
Hi @scttnlsn,
Haven't been able to update this PR with an answer to your questions. RequireJS is awesome, but unfortunately really poorly documented, and answer your questions a bit tough without starting from the beginning :D. Anyway, Just got back to actually working with backbone.io in my project, so I figured I'd hold off on this PR until I work with it further and make sure it's fine.
In the meantime, for anyone who is interested in shimming this for AMD without a code modifications like my PR, RequireJS 2.1.0+ lets you shim with config now, like this:
requirejs.config({
paths: {
jquery: 'bower_components/jquery/jquery',
underscore: 'bower_components/underscore/underscore',
backbone: 'bower_components/backbone/backbone',
io: 'socket.io/socket.io',
backboneio: 'socket.io/backbone.io'
},
shim: {
backbone: {
deps: ['jquery', 'underscore'],
exports: 'Backbone'
},
backboneio: {
deps: ['backbone', 'io']
}
}
});
This follows from https://github.com/marionettejs/backbone.marionette/wiki/Using-marionette-with-requirejs
Actually, closing this. Shimming via RJS config works fine.
Also, wow— this is totally a dupe of https://github.com/scttnlsn/backbone.io/issues/8
Hi Scott,
Thank you very much for backbone.io.
Please consider this shim to support using this module with AMD loaders/one-file optimizers like RequireJS or almond. It's pretty basic follows the likes of backbone-amd and underscore-amd: https://github.com/amdjs/backbone/blob/master/backbone.js
Thanks, Dmitry