I've been toying with the idea of rebuilding a very antiquated in-house CMS using backbone.js so that I build more of an app than a website. So far I'm comfortable with backbone and I've added in require.js to break the application into modules but there's one small thing that's bothering me.
My impression of backbone is that it would be possible to deliver the application to the user in a single initial payload but since adding require.js all models, collections, views, and templates are fetched individually on an ad-hoc basis.
Is it possible to break my application into modular payloads? For instance if the user enters the news section of the CMS they are delivered all the views, models etc. required for that module? The only solution I can think of is wrapping all the pieces of a module in a single define function call but this seems to break the paradigm of uncoupling the pieces of the application as a whole.
try using requirejs modules
Check this out
I made an boiler-plate using requirejs, I call every module as an app, you can compile one JS file per module, and coupled with coupled with
you can load each module on demand. But you got to follow the url pattern I do follow. like
Whole app architecture is work in progress but you get enough insightsAnswer2:
I think I've figured this out for myself. It looks like it's possible to use r.js (<a href="http://requirejs.org/docs/download.html#rjs" rel="nofollow">http://requirejs.org/docs/download.html#rjs</a>) to compile modules into a single script which is exactly what I need.