Just want to ask the gurus out there about this. I know that CSS files are better merged instead of separated into a zillion files. Does js work the same way? Here’s a few points I currently know(or believe…so you can point something out if my belief/understanding is wrong):
- i know that js is better modularized for easier maintenance
- it’s “risky” to merge all files into one since there are functionalities that you just want to be on a certain page.
- i know concurrent downloads slow down a page so it’s better to just do 1 big file.
- merging into 1 file might cause problems with variable scoping?
- i know there are javascript compilers ala bundle-fu or YUI, but is that the answer to all? different files for dev then just 1 file for js?
You don’t need to use the same files for development and production, so you can have the best of both worlds: modularisation for development, and concatenation for deployment. Here’s a list of tools for concatenation and minification.