Archives for Monday, January 21st, 2008
You are currently browsing 1 article(s) published on Monday, January 21st, 2008, please try the search if you can't fint what you're looking for.
Javascript compression PHP class
Monday, January 21, 2008
In addition to my CSS compressor and constants parser I've also written a very simple Javascript compressor class that uses Nicolas Martin's PHP port of Dean Edward's Javascript packer.
It works in exactly the same way as the CSS-compressor. Create a new instance, pass the directory(ies) you want to look for .js-files in and then call the pack-method.
$jsc = new JSCompressor('js/');
echo $jsc->pack();
Reducing the number of HTTP requests the browser needs to make is essential for performance. Together with full packing of all the code, file-size is often reduced by up to 70% and the number of HTTP requests always down to 1.
Download the demo and have fun!
- Comments are off
- Filed under Javascript, PHP





