What are some standard practices for managing a medium-large javascript app? My concerns are both speed for browser download and ease and maintainability of development.
Our JS is roughly "namespaced" eg:
var Client = {
var1: '',
var2: '',
accounts: {
/* 100's of functions and variables */
},
orders: {
/* 100's of functions and variables and subsections */
}
/* etc, etc for a couple hundred kb */
}
At the moment, we have one (unpacked, unstripped, highly readable) javascript file to handle all the business logic on the web app. In addition, there is jQuery and several jQuery extensions. The problem we face is that it takes forever to find anything in the JS and the browser still has a dozen files to download.
Is it common to have a handful of "source" js files that get "compiled" into one final, compressed js file? Any other handy hints or best practices?