How many of you compress your javascript and put it in the bottom of the page? I recently learned that you can optimize the speed of your page loads by
putting links to external javascript files at the bottom of the page just inside the BODY tag.
I use the
YUI Compressor for javascript files. I formerly used
JSmin, but now I just use YUIC. What's your preference? If so, why?
Today I hacked a simple PHP script to recursively poll through a folder of javascript files organized within folders in my application and run them through YUIC and save them to a separate folder for publishing to the production server. With 391 files in 52 folders, this is a time saver! Previously I would call up the Windows cmd window and do them manually one-by-one as I needed. If anyone is interested in the code for the script, I'd be happy to share.
My next step is to automate preparing my application for deployment by writing a script to call IonCube to encrypt PHP files and call YUIC to minify both javascript and CSS files.
Tags: