Creative Commons License

Extra Applications

php4/Class.JavaScriptCompressor
 
5992no demo link[ code ]2006-08-02 07:04:15
This class can compress one or more JavaScript code removing comments, some spaces, and compressing in a "packer" way.

Thanks to Dean Edwards for his originally idea [dean.edwards.name]

New on version 0.8
Best performance on server!!!
Improved 4X with class SourceMap:
http://www.devpro.it/javascript_id_125.html

F ixed a lot of parsing problems, for example, with this new version, dojo.js.uncompressed.js file (about 211Kb) has been reduced to 131Kb just cleaning code and successfully packed into 90Kb with getPacked method!


New on version 0.7
PHP parsing 2 times faster
JavaScript source compatibility 5X better (no more Dean Edwards packer rules, then prototype.js file, for example, is packed correctly)
Requires JSL for totally packer javascript convertion browsers compatibility [read more inside class comments]
Removed base 64 convertion, too slow with big sources


New on version 0.6b (experimental)
sources greater than 60Kb should use new base62 compression using true on contructor:
$JSC = new JavaScriptCompressor(true);
Read comments to know more


New on version 0.6:
fixed some PHP convertion errors, wrote a faster JS evaluation (1 loop and not 2), modified getClean (now some spaces after comments are removed)


New version 0.5 use BaseConvert class for a better compression and a faster JS convertion (and has some little fix).


Version 0.4 has been successfull tested with many JS files and compression is quite faster and better.