I’m really digging James Burke’s RequireJS library. Love the lazy loading, module separation, dependency management, and build optimization. Not to mention that RequireJS is essentially the loader from Dojo, which has a proven track record among many successful installs.
One of the things I appreciate most is the dictated JS file stucture. Module definitions always follow the same pattern, bringing sanity to a JS development stack.
Sanity — that’s why I need it. Maybe you do too? That is, follow RequireJS as a pattern for both your development and production environments and simply — be DONE with it.
There ya have it. Organization. Performance. Sanity. (Lovely, ain’t it?)
I’d really like to throw together a post with an actual implementation and some code, but I’ll have to settle for a link to James’ page for the time being.
RequireJS: http://requirejs.org/
Good luck — have fun.