I’m using a shared hosting plan on Hostgator. As such I can’t run any java from the command line.
Is there any pure PHP minifiers out there that I can use? Minify uses YUICompressor.jar in the background so that won’t work.
Anyone know of something that uses just PHP to minify javascript that I can run from the command line? I would also like it to shrink variable names.
You could use the google js minifier. Here’s a python script which uses it to compress a bunch of javascript files with it:
Usage:
python filename.py path/to/your/*.js > minified.jsIn case you are using an ancient python version and do not have simplejson installed on your system, here’s how you can get the script to work with a local simplejson version (run those commands via SSH):