[Phpwm] Optimising javascript

Greg Jones greg.jones at gmail.com
Thu May 10 07:57:52 BST 2007


On Thu, 10 May 2007 07:40:40 +0100, Keith Pope <keith.pope at allpay.net>  
wrote:

> There are quite a few minifiers about for javascript:
>
> http://www.crockford.com/javascript/jsmin.html
>
> http://joliclic.free.fr/php/javascript-packer/en/ - Nice PHP 5 one :)
>


That PHP one is a port of a web-based javascript one:  
http://dean.edwards.name/packer/
It does a good job of minimising (and obfuscating) your javascript, but  
does require you to be a bit stricter with your coding. Ending lines with  
a ; is optional in js, but the packer requires it. As PHP coders, I would  
think that would be 2nd-nature anyway (was for me), but having to put a ;  
after a function or object definition is a little odd, and I had to go  
through quite a lot of code adding them for it to work. Prototype and  
scriptaculous code won't, from the standard distribution, work after being  
packed like this, although people have provided modified versions that do.


Greg


-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



More information about the Phpwm mailing list