An opinion on including multiple JS files in your project

There are many ways to solve an issue. Some work better than others though their pureness may be questionable. Getting many JS scripts and modules loaded is one such puzzle. I’m not a huge fan of require.js for a number of reasons that are already clearly, and eloquently, expressed by others. It is great at what it does, just not what I really want to use.What I do like is using a tool such as YUI compressor to facilitate delivering robust production code.

The following code is something I found on which I have since extended and included into my own projects.


# This script generates the following:
# Combined and minified javascript file for use in the app

"Combining JavaScript into temp files."

# temp.js is the uncompressed file with everything combined
> ./app/js/temp.js

"Compressing Combined JavaScript."
-jar yuicompressor-2.4.7.jar --type js -o ./app/js/temp.js --charset utf-8 ./app/js/combined.min.js

"Cleaning up temporary files."


And yes, I do work on OSX as well as Win8.