Reputation: 1827
I have made a backbone app but the entire code is in one page. I want to separate out the views and collections and the templates in separate files. I'm not using require.js nor any other boiler plate. Is there any method by which I can separate the code in files ? The main purpose of MV* architecture is to keep code and UI separate.
Upvotes: 1
Views: 582
Reputation: 146014
Yes, there are many ways to do this. I prefer coding each module as a CommonJS/node style file and using browserify to resolve dependencies and concatenate files to send to the browser.
Another choice would be RequireJS, which is among the most popular at the moment, although the community is still mostly undecided/unspecified/many-options mode.
Probably the other popular option is using a build tool (rails asset pipeline, gulp, grunt, etc) to combine separate files into either one big file for the whole app or one big file for each major portion of the app.
Upvotes: 1