New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module/Require Features #94

Closed
francoislaberge opened this Issue Nov 24, 2010 · 4 comments

Comments

Projects
None yet
4 participants
@francoislaberge

francoislaberge commented Nov 24, 2010

Maybe I'm missing it, but there is no module loading support in backbone.js, is that correct?

If so are people using RequireJS? I've like it on other projects, just evaluating JS libs right now and Backbone is looking just the right balance between heavyJS Frameworks and a sparse javascript libs.

@tapichu

This comment has been minimized.

Show comment
Hide comment
@tapichu

tapichu Nov 25, 2010

I used both in this sample project.
I hope you find it useful!

tapichu commented Nov 25, 2010

I used both in this sample project.
I hope you find it useful!

@jashkenas

This comment has been minimized.

Show comment
Hide comment
@jashkenas

jashkenas Nov 27, 2010

Owner

That's correct -- there is no module loading support. I don't think that the to-RequireJS-or-not-to-RequireJS has anything to do with Backbone, really.

My personal opinion is that JavaScript module loading has no place in web applications. You should be concatenating, compressing, and gzipping your JS assets as a single file, so that your app can be loaded with a single cacheable HTTP request (preferably with far-futures expires headers). Our own stab at doing this sort of thing in the context of a Rails app is available here:

http://documentcloud.github.com/jammit/

Dynamic module loading can make sense in the context of truly enormous JS apps like GMail, where you're talking about megabytes of JavaScript that should only be loaded when that portion of the app is accessed, but good asset packaging is still useful for that, and things like RequireJS are still overkill.

Owner

jashkenas commented Nov 27, 2010

That's correct -- there is no module loading support. I don't think that the to-RequireJS-or-not-to-RequireJS has anything to do with Backbone, really.

My personal opinion is that JavaScript module loading has no place in web applications. You should be concatenating, compressing, and gzipping your JS assets as a single file, so that your app can be loaded with a single cacheable HTTP request (preferably with far-futures expires headers). Our own stab at doing this sort of thing in the context of a Rails app is available here:

http://documentcloud.github.com/jammit/

Dynamic module loading can make sense in the context of truly enormous JS apps like GMail, where you're talking about megabytes of JavaScript that should only be loaded when that portion of the app is accessed, but good asset packaging is still useful for that, and things like RequireJS are still overkill.

@rmurphey

This comment has been minimized.

Show comment
Hide comment
@rmurphey

rmurphey Dec 3, 2010

Agree that module loading isn't relevant to Backbone, but I did want to clarify: RequireJS lets you specify dependencies in your development code, and then create combined, minified, and optimized files for production using its optimization tool. For browser-based JS, its goal isn't so much to let you do module loading in production as it is to let you develop small units of functionality, express dependencies between them, and know that you can generate optimized code when you're done.

rmurphey commented Dec 3, 2010

Agree that module loading isn't relevant to Backbone, but I did want to clarify: RequireJS lets you specify dependencies in your development code, and then create combined, minified, and optimized files for production using its optimization tool. For browser-based JS, its goal isn't so much to let you do module loading in production as it is to let you develop small units of functionality, express dependencies between them, and know that you can generate optimized code when you're done.

@francoislaberge

This comment has been minimized.

Show comment
Hide comment
@francoislaberge

francoislaberge Dec 3, 2010

Thank Rebecca, I hadn't had the time to reply. Those are basically my thoughts on the subject.

I was only asking before if there was a module system that people were using that was either a part of it or typically used by others. I'm using RequireJS everywhere, including on the backend.

I worked with James to flush out some bugs I was having, my app uses a lot of other Frameworks/Projects and it now works perfectly with modules built to work in both environments. So far it is mostly form validation and Object/Storage Serialization/Deserialization that is being used. It has been very helpful.

Just saying.

francoislaberge commented Dec 3, 2010

Thank Rebecca, I hadn't had the time to reply. Those are basically my thoughts on the subject.

I was only asking before if there was a module system that people were using that was either a part of it or typically used by others. I'm using RequireJS everywhere, including on the backend.

I worked with James to flush out some bugs I was having, my app uses a lot of other Frameworks/Projects and it now works perfectly with modules built to work in both environments. So far it is mostly form validation and Object/Storage Serialization/Deserialization that is being used. It has been very helpful.

Just saying.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment