Personally, I still like keeping things organized but I don't want to sacrifice performance for it. So, I've started using the following approach for all my sites:
- Create two ColdFusion pages (or PHP, Ruby, etc) that change the mime type to "text/js" and "text/css" respectively.
- Then include all the appropriate js or css files using <cfinclude>.
/* js_compilation.cfm*/
<cfcontent type="text/js">
<cfinclude template="js/core.js">
<cfinclude template="js/prototype.js">
<cfinclude templat="js/rico.js">
- Lastly, you should simply reference that file in the Head section of the calling page.
<script src="js_compilation.cfm" type="text/js">
Do the same thing for all your assorted CSS files and you're load time should be significantly improved without sacrificing organization. You can keep your file structure simple and efficient.
Cheers,
Todd
PS-I know everyone should be crunching their JS files into one library but we can't all afford to do that. This is a simple step that everyone can handle.