Then I stumbled on a question on Quora about merging files vs keeping them separate. Basically the question is something like this:
In this post I would like to discuss my view on this matter after reading through all the comments on Quora.
Reducing HTTP requests
The problem of premature optimisation
Local environment vs production
Vendor packages and your app logic
Some answers were a bit more specific and talked about app code (your logic) vs vendor code (libraries such as jQuery, Underscore, Backbone, jQuery-ui etc.). Since it is assumed that the libraries aren’t updated as often as your own code base, it would make sense to package the vendor code in one file and your app code in another. This way, users only have to load the vendor package once (they will be cached) and changing the app code in between visits (and using some sort of versioning to prevent loading the old one from cache!), they only load the changed script.
How do they do it?
For the latter one I will discuss working with both RequireJS and Browserify in an upcoming post. Yes, I am using Browserify now and I think it is much simpler to set up and use in comparison to RequireJS.