echo "Creating default layout min js ..."
java -jar ~/tmp/bin/yuic.jar jquery.min.js > layouts/min.default.js
java -jar ~/tmp/bin/yuic.jar layouts/default.js >> layouts/min.default.js
With the above script the two files that I use in the default template of my application is combined into just one file. Please note that the first compression line pipes the output by replacing, using >, the contents of min.default.js and the second (and any other lines) will append to min.default.js using >>. Please note that the script assumes that you have installed the YUI Compressor in your tmp directory, your actual YUI Compressor path and executable file name will be different.
The example I used is a very simple case that doesn't actually require such optimization. However if you have a complicated website that utilizes 10 different jQuery plugins that even if all are cached with change timestamp checking time of 200ms, the script can save almost two seconds from your page's loading time.