PDA

View Full Version : new the-yui-compressor for js


nassaja-rus
08-15-2007, 02:16 AM
http://www.julienlecomte.net/blog/2007/08/13/introducing-the-yui-compressor/

Who already tried?

matjaz
08-15-2007, 06:47 AM
It shrinks ext-all additionally by 20kB so it's no a big deal.

I'm using Dean Edwards packer and it's great.
This one promises us same quality without issues with eval and with statements.
So generally it's a promising tool !

jgarcia@tdg-i.com
08-15-2007, 12:05 PM
20Kb is pretty damn huge.

J.C. Bize
08-16-2007, 02:03 PM
good deal, thanks for the heads up!

Animal
08-20-2007, 05:34 AM
I just changed our ant build to use the yui-compressor rather than Dojo's version. It's smaller, and Dojo's version seems dojoishly flaky - it sometimes blows up

jgarcia@tdg-i.com
08-20-2007, 11:21 AM
I just changed our ant build to use the yui-compressor rather than Dojo's version. It's smaller, and Dojo's version seems dojoishly flaky - it sometimes blows up



Interesting term: dojoishly :)

http://i157.photobucket.com/albums/t76/guinnea1/44.gif

trbs
08-20-2007, 12:10 PM
I just changed our ant build to use the yui-compressor rather than Dojo's version. It's smaller, and Dojo's version seems dojoishly flaky - it sometimes blows up

yeah i also have had (almost) nothing but problems with Dojo's ShrinkSafe, they really should rename that to Tool-That-Blows-Up-In-Your-Face-ShrinkSafe :))

Saeven
08-22-2007, 04:57 PM
Ex-dojo victim here too, I've never jumped a better fence than that which leads from Dojo to Ext.

jheid
08-28-2007, 05:57 AM
I've just tried the new YUI compressor version 2.0 with ext-all.css. Got it down from 68k to 58k.

What about integrating css compression, too?

matjaz
08-28-2007, 06:47 AM
With 2.0 this is also possible. ;)

jheid
08-28-2007, 09:23 AM
With 2.0 this is also possible. ;)

What do you mean? Ext 2.0? JS Builder 2.0 or YUI compressor 2.0 (this is what I'm saying...)?

jack.slocum
08-30-2007, 07:51 AM
The 1.1.1 build was built with the yui-compressor. It resulted in about 12k drop in file size. I also used it for the CSS. :)

jon.whitcraft
08-30-2007, 08:01 AM
I'm currently looking into making the yui-compressor the engine for the Java Builder tool. More will come after i get some time to work on it more after this weekend.

trbs
08-30-2007, 11:53 AM
I'm currently looking into making the yui-compressor the engine for the Java Builder tool. More will come after i get some time to work on it more after this weekend.

I will also build the yui-compressor into the Python Builder tool as soon as possible!

(p.s. the most recent version of python tool 0.7.1 is already 800% faster then 0.7.0, if you have the python just-in-time compiler named psyco installed :D )

Condor
08-31-2007, 03:29 AM
The YUI Compressor is under heavy developement.
At time of writing the latest version is 2.1.1 and can be obtained from a new url:
http://www.julienlecomte.net/yuicompressor/

mystix
08-31-2007, 02:25 PM
yay. add me to the club.

we just switched from ShrinkSafe + Dean Edward's packer to yuicompressor today after i saw trbs's post in the translations thread :D

minifying has never been faster.

trbs
08-31-2007, 08:45 PM
Please be aware that for you'll explicitly need to enable --charset utf-8 with yui-compressor to build a completely working extjs.

This is a bug that i've also reported in the Bug Forums for the Ext 1.1.1 build.

Explanation
The locale files use UTF-8 encoding to support many non-ascii languages. The yui-compressor does not automaticly detect the correct character encoding for these files and tries to decode them with a ascii charset. This results in all non-ascii characters being mangled into ascii character 63 - the question mark.

mystix
09-01-2007, 02:29 AM
ah just replied to trbs in the bugs thread...

[copied and pasted from bugs]
got this from the YUI Compressor download page (http://www.julienlecomte.net/yuicompressor/):


--charset character-set
If a supported character set is specified, the YUI Compressor will use it
to read the input file. Otherwise, it will assume that the platform's
default character set is being used. The output file is encoded using
the same character set.


HTH

trbs
09-01-2007, 09:45 AM
For completeness sake; my Debian Linux appearenly defaults to ASCII as does Jack's Windows Vista machine appearently, since the official build sports the same problem.

steffenk
09-17-2007, 04:30 PM
i checked out this one:
http://joliclic.free.fr/php/javascript-packer/en/

it dropped 126kB with ext-all.js - that's incredible!

Animal
09-18-2007, 06:02 AM
Yes, but

<span style="Dr. Szell">Is It Safe?</span>

mystix
09-18-2007, 06:38 AM
and does it decompress fast (read: fast + low cpu usage) on a normal (read: non-development) machine?

AFAIK, dean edward's packer at max js compression also results in max decompression time.

jon.whitcraft
09-18-2007, 06:48 AM
I'm gonna stick with the yuicompressor and gzip file compression on the fly. It does want i need it to and i can sill make out some of the functions for quick debugging.

mystix
09-18-2007, 06:58 AM
I'm gonna stick with the yuicompressor and gzip file compression on the fly. It does want i need it to and i can sill make out some of the functions for quick debugging.

agreed. i'm sticking with yuicompressor too.
tried various combinations of ShrinkSafe + Packer before, but they pale in comparison to yuicompressor.

steffenk
09-19-2007, 03:59 AM
ok, i run into problems with Dean Edwards 's Packer. Everything worked well: Layouts, dialogs, Accordion - but grid failed.

Animal
09-19-2007, 04:37 AM
Dean Edwards' Packer mungs the semantics of the code in some situations.

Check Julien Lecomte's blog entries about the yui compressor.

It does seem like YAHOO is the best option.

steffenk
09-19-2007, 05:20 AM
does mootools use Dean Edwards' Packer ? May be they only linked to it.
I think YUI-compressor works best atm. Anyway i will inform Edwards, may be he fixes something.

mystix
09-27-2007, 01:57 AM
be careful when compressing with the latest yuicompressor-2.2.1.jar.

one new feature was added

YUI Compressor 2.2.1, 2007-09-25
--------------------------------

+ Optimize quote escaping in JavaScript string literals by using the best quote
character (' or " depending on the occurrence of this character in the string)


which for some strange reason, turned this line in ext-all-debug.js

document.write("<s"+'cript id="ie-deferred-loader" defer="defer" src="/'+'/:"></s'+"cript>");


into

document.write("<s"+"cript id="ie-deferred-loader" defer="defer" src="/"+"/:"></s"+"cript>");

which killed the minified script.

i've tried to inform the author of this. let's hope he replies soon.

steffenk
09-27-2007, 11:16 AM
Does anybody have expierience with ESC ? A friend of mine does all his javascript with this compressor, see his page (http://www.malleus.de/)

mystix
09-28-2007, 08:43 AM
be careful when compressing with the latest yuicompressor-2.2.1.jar.

one new feature was added


which for some strange reason, turned this line in ext-all-debug.js

document.write("<s"+'cript id="ie-deferred-loader" defer="defer" src="/'+'/:"></s'+"cript>");


into

document.write("<s"+"cript id="ie-deferred-loader" defer="defer" src="/"+"/:"></s"+"cript>");

which killed the minified script.

i've tried to inform the author of this. let's hope he replies soon.

did some more testing.
this works (i.e. yui-compressor-2.2.1 doesn't mess up when minifying ext-all-debug)

document.write("<s"+"cript id='ie-deferred-loader' defer='defer' src='/"+"/:'></s"+"cript>");


but the minified version gets cleverly optimised to

document.write("<script id='ie-deferred-loader' defer='defer' src='//:'></script>");


looks like the only way to preserve the original string is to do this

document.write(["<s",'cript id="ie-deferred-loader" defer="defer" src="/','/:"></s',"cript>"].join(""));


@jack/brian, any thoughts?

scratch all that.
yuicompressor-2.2.2 is out. :)

jheid
09-29-2007, 04:35 AM
Just checked the version 2.2.3 with ext-all.js for 2.0 generated from SVN.

Packed by JS Builder 1.1.2.0: 553.967 Bytes
Packed by yuicompressor: 2.2.3.0: 504.785 Bytes

That is at about 9% additional saving.

FonkeyMucker
02-13-2008, 01:21 PM
Just checked the version 2.2.3 with ext-all.js for 2.0 generated from SVN.

Packed by JS Builder 1.1.2.0: 553.967 Bytes
Packed by yuicompressor: 2.2.3.0: 504.785 Bytes

That is at about 9% additional saving.

JavaScript Options
--nomunge Minify only, do not obfuscate
--preserve-semi Preserve all semicolons
--disable-optimizations Disable all micro optimizations

If JS Builder is using YUI Compressor, it's probably using the |--nomunge| option. Can anyone confirm?


I like munging; I also like to keep my semis and disable the optimizations like string alteration and converting #FF0000 to red.

Is there a way set these options in JSBuilder?