I’ve been getting into Backbone.js lately and I’m enjoying it so far. All the examples tend to be simple to-do lists, so it’s been a little difficult extrapolating code organization and file structure for a larger/more robust single page application.
I’ve come to a crossroad:
- Should I use something like Yepnope.js to load models and views as I need them or,
- Combine and minify into fewer files and front-load it all.
- Some combination of both?
Any advice would be appreciated!
It depends of the size of your app. If you have a bunch of different views its definitely worth to start with a loader, where you can start the app with minimal feature set and load other views when needed. I can’t tell anything about yepnope, but it seems the focus is more about polyfills then to structure your app with modules. We use requirejs for our app, and it works really well. You have to write a bunch of boilerplate code for the AMD modules but its really worth it.