This new version of the compressor fixes a few bugs and implements a few additional micro optimizations. Please refer to the CHANGELOG file for a complete list of changes, and don’t hesitate to report any issue you may experience with this version of the YUI Compressor.
Download version 2.3 of the YUI Compressor
Thanks for this update. Using it and liking it.
Thanks for your continued work on this. I use it on my website World of Solitaire to compress all my JavaScript and CSS files and I’ve never once had a problem with the YUI Compressor.
It’s the best one out there in my book and I intend to use it in all future web projects.
Thanks again for working on it :)
Thank you for your excellent compressor. We are using your compressor on our webapplication and thereby cutting the javascript size in half!
While using the new version I noticed a problem with the following rulechange “Transform ‘foo’: … into foo: … whenever possible, saving 2 bytes.”. The problem occurs when you use the keyword ‘class’ instead of ‘foo’. IE will generate a runtime error “Error: Expected identifier, string or number”. It looks like IE does not like keywords in object notation. Is there a way to overcome this problem?
Thanks.
@DLems
Thanks for the bug report. Version 2.3.1 (now available for download) fixes that minor issue.
Regards
Hi Julien. I am developing a java solution that does combination and minification on javascript and CSS files in web applications.
The project is called Jawr (btw, in the docs there is a guide to use Jawr with the Yahoo! UI library).
I currently use JSmin for the minification process and I would like to add the excellent YUI compressor to my library.
The thing is, my project uses Maven and I haven’t found the YUI compressor at any Maven repository.
I checked the source for the Yui compressor Maven Mojo and they have included your source code along with theirs. Would you allow me to do the same thing? Or, if not, are there any plans to publish the YUI compressor via Maven?
Thank you very much in advance.
You are the man! Keep up the excellent work on this. Could you please add an additional param to strip the /*! comments?
Ever since v2.2.5 onwards, I’ve had problems using the compressor. The issue is when compressing the ext-base.js file from extjs. You can find a copy (providing a direct link to make your life a bit easier!)
The problem seems to be on this line:
var header = headerStr.split(‘\n’);
The compressed js seems to treat \n as-is, and shows up as:
split(”
” //note how the close quote ends up on the next line, and the \n is added as-is to the output
@Hani
First of all, the file you refer to is already minified using the YUI Compressor. Second, I cannot reproduce your issue using the YUI Compressor v. 2.3.4. Are you running the compressor from an Ant script?
Apologies, here’s the right link:
I’m not invoking it from ant, I have a servlet that compresses js on the fly (and deals with boring things like caching and gzipping).
Hi Julien,
I too have the same problem as that of Hani and I use Ant build. It’ll be great if you can solve this issue or give us a direction.
Thanks and Regards
Vinamra
It looks like the javascript option for -preserve strings is no longer available. I am using version 2.3.5.
Hi again Julien. Was this the wrong place to ask? If so I am sorry. But, please, could you tell me what can I do to get some feedback on my question? I’d really like to use your compressor in my tool. Thanks.
It would be a good idea to “solve this problem” :
when compressing swfobject 2RC1, the conditionnal arguments are preserved, but obfuscation is disabled.
Enabling obfuscation + preserving conditional arguments would be interesting in this case.
@Jordi
This is what you are looking for:
I don’t have any additional information. Sorry.
@Matt
There is now a -disable-optimizations flag that disables all micro optimizations at once. No individual flags anymore for simplicity.
Regards
@Hani
I still cannot reproduce your problem. Do you have the original version of rhino somewhere in your class path? (look for a js.jar) If so, that is the problem! The YUI Compressor uses a modified version of rhino and there might be some class naming conflicts.
Regards
Sorry, I think I didn’t explain myself correctly. What I am asking for is to use and include the YUI compressor sources in my project. I don’t intend to use anything from the maven mojo. Just your code. Can I please do that? The Maven mojo is doing it, that’s the reason why I mentioned them.
Thank you and regards
@Jordi
The YUI Compressor is licensed under the BSD License. Please read the terms of this license at:
Regards
Aha! It works if I remove the rhino jar from my project. I didnt realise yuicompressor.jar includes the rhino classes too. Thanks for the fix!