[wp-hackers] Re: Packing JavaScript

Computer Guru computerguru at neosmart.net
Tue Sep 18 13:57:08 GMT 2007


I believe that is the same method used by the DoJo ShrinkSafe compressor..
I'm not a real JS coder (or even a fan), but this is from their site:


ShrinkSafe is a JavaScript "compression" system. It can typically reduce the
size of your scripts by a third or more, depending on your programming
style.

Many other tools also shrink JavaScript files, but ShrinkSafe is different.
Instead of relying on brittle regular expressions, ShrinkSafe is based on
Rhino <http://mozilla.org/rhino>, a JavaScript interpreter. This allows
ShrinkSafe to transform the source of a file with much more confidence that
the resulting script will function identically to the file you uploaded.

Best of all, ShrinkSafe will never change a public variable or API. That
means that you can drop the compressed version of your JavaScript into your
pages without changing the code that uses it.

I dunno.


On 9/18/07, Christian Höltje <docwhat+list.wp.hackers at gerf.org> wrote:
>
> Compressing the JS definitely would be a win.
>
> The best safe compressor I know of at the moment is Julien Lecomte's
> YUI compressor.
>
> Don't be fooled by it's name, it works for anything.
>
> The way it works is it uses a JavaScript interpreter to build a parse
> tree of the JavaScript and writes out the JavaScript again.
>
> This allows it to safely interpret the JavaScript and therefor safely
> write it back out.
>
> In addition it can now do safely do variable renaming since it knows
> the scope of variables.  It can tell if the scope of a variable is
> outside the code it is compressing and then not rename it.
>
> In tests that I have seen and the few informal ones I have done, YUI
> Compressor performs better than any of the other minifiers I have
> seen.
>
>
> http://www.julienlecomte.net/blog/2007/08/13/introducing-the-yui-compressor/
>
> Ciao!
>
> --
> He who has imagination without learning has wings but no feet.
>         -- Joseph Joubert
>
> The Doctor What: "What, Doctor What"             http://docwhat.gerf.org/
> docwhat *at* gerf *dot* org                                        KF6VNC
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Computer Guru
Director,
NeoSmart Technologies
http://neosmart.net/blog/


More information about the wp-hackers mailing list