YUI Compressor Version 2.2.1 Now Available

I implemented a few enhancement requests and fixed a bug in this new version of the YUI Compressor. Let me know if you encounter any issue with it.

Update (9/27/07): YUI Compressor version 2.2.2 is now available. It fixes a lot of bugs that have been reported recently. By the way, I really appreciate all the bug reports, so keep them coming!

Update (9/28/07): New bugs have been reported and fixed in version 2.2.3 now available for download (check out the CHANGELOG file in the download page) And keep these bug reports coming!

Update (10/1/07): A few more minor bugs have been fixed in version 2.2.4. Thanks for the bug reports!

Download version 2.2.4 of the YUI Compressor

27 thoughts on “YUI Compressor Version 2.2.1 Now Available

  1. Alexey D. Terekhov

    @David Bernard

    Please add a possibility in Yuicompressor Maven Plugin to ommit suffix for compressed resource files (i.e. style.css become style.css in target direcory instead style.css). It’s very important for me to have compressed js and css files with the same name as it have initially.

    With different combination of “suffix” and “nosuffix” config parameters i can’t do what i need (b.t.w. documentation is pretty unclear for this options…).

    P.S: i write feature request for plugin (not for compressor intself) here, because i couldn’t find another way to contact with the author of that helpfull plugin.

  2. Alexey D. Terekhov

    Remarks for my previous comment:
    (i.e. style.css become style.css in target direcory instead style-suffix.css)

  3. Pingback: YUI Compressor Version 2.2.1 » Chris Norton

  4. Papandreou

    Great piece of work! However, version 2.2.1 apparently introduced an error in the string literal optimizer:

    var foo = ”+’”‘;

    is incorrectly shortened to

    var foo=””‘

    Also, conditional compilation isn’t supported everywhere (YUICompressor 2.2+). In particular, this construct throws an EvaluatorException:

    var isIE = false /*@cc_on || true @*/;

    An (even uglier) workaround for this issue:

    var isIE = eval(“false /*@cc_on || true @*/”);

    Best regards,
    Papandreou

  5. Alexey D. Terekhov

    @David Bernard

    Well… All my problems with no-sufix have been solved when i completly removed net.sf.alchim.* from my local maven repo and redownload them in next build…

  6. Marc

    @julien,

    (this is likely to be related to @Papandreou’s post)
    this code:
    document.write(“”);

    gets transformed into:
    document.write(“”);

    keep up the great work!!

  7. Marc

    @julien,

    sorry, previous code got mangled upon submission

    (this is likely to be related to @Papandreou’s post)
    this string:
    “”

    gets transformed into:
    “”

    keep up the great work!!

  8. David Bernard

    @Maven’s users (Alexey,…)

    * to update maven’s plugin, you could remove it from your local repository or use the -U option (eg: “mvn -U package” => update of every plugin required to go to ‘package’ phase, and go to ‘package’ phase).
    * you could contact me via the sourceforge’s tracker or via the email set (already done by others users who ask for “nosuffix”).

    I’ll publish a new version of the plugin (upgrade to yuicompressor 2.2.1) next week-end.

  9. Rob Scott

    I recently starting using YUI Compressor — great tool!

    Now to the issue :-) I’ve noticed that it barfs on files with a BOM (byte order mark). I’m guessing Visual Studio inserts the BOM; editing the files in a text editor and re-saving them fixes the problem. It would be nice if YUI would remove the BOM. Any other suggestions?

    Thanks!

  10. Tjerk

    Version 2.2.2 (and earlier) causes problems for IE6 with the jQuery library (v1.2.1)

    The $(function(){}); construct is no longer working after compression.

  11. Julien Lecomte Post author

    @Rob Scott

    There is no problem with the byte order mark. The problem here is that you are not specifying the correct character encoding (the compressor cannot guess which character encoding you used to edit the file, so you need to specify it if you did not use your platform’s default encoding) I tested this using UltraEdit, saving a JavaScript file using Unicode editing. I then gave the --charset UTF-16 option to the compressor, and it worked.

    Regards

  12. Ionel Roiban

    If a css file contains a comment larger than 808 characters the compressor version 2.2.3 fails.

  13. Jeses Dowell

    I seem to be having a problem with strings containing ‘\n’ in the source files. Seems like the compressor (post 2.1) is translating these to literal newlines in the output causing unterminated string literal problems with the generated javascript.

    Anyone else having this problem? Maybe it’s a platform issue (I’m running on Linux)?

  14. Jesse Dowell

    I tried 2.2.4 and was having problems with the newline. Interestingly enough the problem doesn’t appear in version 2.1 and prior versions.

    BTW - thanks for the great tool!

  15. Julien Lecomte Post author

    @Jesse

    With version 2.2.4, the following:

    var s = “xxx\nyyy”;

    is compressed to:

    var s=”xxx\nyyy”

    I don’t see any problem with line-breaks. With version of Java are you using? Are you redirecting the standard output, or are you using the -o option?

    Thanks

  16. Jesse Dowell

    Sorry, I did some further testing and discovered that it’s somehow related to my environment. I did some experimenting and found that 2.2.4 works perfectly for me if I run it from the command line ‘java -jar yuixxxxx’. If I run it as an ant task, however, this input ‘(?:)((\n|\r|.)*?)(?:)’ results in a line break in the generated file. It’s very odd that the 2.1 version does work for me from the ant script.

  17. Jesse Dowell

    It was something on my classpath that was causing the problem. I changed my ant task around a bit and it works flawlessly now. Sorry about the bogus report.

  18. Stefan Kudwien

    Hm, I am wondering if it this change:

    + Remove line terminator after escape in string literals.

    in the latest 2.2.5 release should be changed to inserting a escaped newline character, instead of just removing the newline. Because right now you’re changing the behavior of a script (shortening string literals - what if a script checks for a specific string length?), that’s IMO something a compressor should never do.

  19. Julien Lecomte Post author

    @Stefan

    This is why the option --preserve-strings (which makes the compressor leave string literals intact) was introduced in version 2.2.3.

  20. Cezary Okupski

    Sorry for an informal way of submitting a feature request - is there a bug track for the compressor? I haven’t found an appropriate category on Sourceforge YUI project. Would it possible to shorten “true” to “!0″ and “false” to “!1″ (without quotes)? It works in all browsers that I’ve got, but you probably test against more.

  21. andy

    @Jesse
    I’m seeing the same problem, where \r and \n are being interpreted out and giving me a line break. Any insight as to what specifically was causing this? I’m seeing this on the 2.2.4 build.

  22. Cezary Okupski

    WebKit (Safari 3) introduces some support for media queries. For example this works:
    @media all and (min-width:0){html{color:red}}
    while omitting the space after “and” like that:
    @media all and(min-width:0){html{color:red}}
    doesn’t.
    YUICompressor removes it. I wonder if you consider this as a bug only for the WebKit developers or something to adjust YUICompressor to.

  23. Benoit Michaud

    Hi,
    Would it be possible to add 1 more option? I’m thinking about some kind of automatic naming of the output.
    the standard one is: -o filename.ext
    I’d love to find: -oo filename-min.ext or anything like that.
    It would help a lot to set some automatic tasks in windows registry, or any IDE…
    Thanks anyway for your work
    Ben

  24. TomaP

    I am using YUIC, and it’s working fine.
    I am wondering if it could replace

    var a = new Array()
    with
    var a = []

    as suggested by JSLint

    Thanks,

    Thomas P

Comments are closed.