This PHP script let you automatize the .js and .css compression using PACKER Javascript for PHP. You can put all the files that you want to compress in a manifest.txt and then run the script every time you modify the original script.
This script no compress files on the fly. This is the important thing here, not to overload the server making file compression. So its is your work to compress the files every time you modify the original ones.
First, download PACKER Javascript for PHP from http://joliclic.free.fr/php/javascript-packer/en/ and APACKER, decompress the files in the same directory.
Second, for example you have myproject-scr.js and myproject-scr.css files. By convention in the script you must name the files using the style xxxxxxxx-scr.js and/or xxxxxxxx-src.css. Then put this name files in a manifest.txt file one name by line.
Finally, upload all the files to your server and point your browser to http://myserver/apacker.php. APACKER automatically output the files myproject.js and myproject.css in the same directory that the original files.
Tags: compression, javascript