YUI Compressor Version 1.1 Now Available

The release of the YUI Compressor last week has generated a lot of buzz and excitement throughout the web development community. Actually, after receiving so much great feedback, I felt compelled to issue a minor update as soon as possible to fix the most important items that were brought to my attention (see the CHANGELOG file for a full list of changes) And please, keep the feedback coming!

Download version 1.1 of the YUI Compressor

10 thoughts on “YUI Compressor Version 1.1 Now Available

  1. KevinH

    Hi there - Experimenting with moving from Dojo’s ShrinkSafe to the YUI Compressor. We started with JSMin and moved to Dojo’s a year or two ago as it provided better compression. Since we include this in our build it would be cleaner to have to output to stderr or stdout. Today it prints the charset. Also it would help if there was an option that is -o was used but no file was given it would write the output to stdout. This way we can capture the output and write it to the file we want rather than having it to name a file in the args or use the hardcoded -min file.

  2. Julien Lecomte Post author

    @Kevin

    Since the YUI Compressor is open source, and under a very permissive license, feel free to make the necessary changes to fit your specific needs.

    Regards

  3. Pingback: CodeClimber

  4. KevinH

    Ideally we don’t want to change the source. We can make the changes on our side for my issues above and have found an easy way to work around this in our build. We did hit another issue integrating with a few servlets we have.

    We used to call ShrinkSafe directly like:

    Context context = Context.enter();
    context.setOptimizationLevel(-1);
    Scriptable scriptable = context.initStandardObjects();
    Reader reader = new StringReader(text);
    String script = null;
    int lineNum = 0;
    Object securityDomain = null;

    String mintext = org.mozilla.javascript.tools.shell.Main.compressScript(
    context, scriptable, reader,
    script, uri, lineNum, securityDomain
    );

    This is a bit ugly but it worked. Looking at the constructor for YUICompressor there is no way to do this without writing out a File (that I can see).

    Would it be possible to add a new constructor option that took an InputStream or a String? This way for those Java programs that already have the input data it would be a very clean two line call to compress/minify source content.

    YUICompressor compressor = new YUICompressor(input, output, charset, munge, warn, linebreak);
    compressor.compress();

    BTW: From initial tests on our source YUICompressor 1.1 is about 9% smaller vs ShrinkSafe after gzipping. Pretty impressive!

  5. Stephan Beal

    Hiya!

    Since YUIMin 1.0 came out i’ve been using it for my jQuery plugins:

    On those pages i release all code as unpacked/packed/min’d/yuimin’d, so it may be interesting for you to see the size differences.

    Would it be possible for you to set up a page specifically for YUImin, instead of in the blog? The reason is so that i know where to check for updates without having to back-track through all of your blog posts and so i can link to yuimin on my web pages (i hate linking to an out-of-date blog post).

    If you set up such a page, please send me an email and let me know the URL.

    :)

    PS: yuimin kicks butt. Great stuff. :)

  6. KevinH

    We found a bug today with the safety of the compression. YUI Compressor doesn’t understand/respect “break LABEL;” Here’s an example from our code that gets compressed into an incorrect result.

    Raw Code:

    AjxTimezone.getRule = function(clientId, tz) {
    var rule = AjxTimezone._CLIENT2RULE[clientId];
    if (!rule) {
    // try to find the rule treating the clientId as the serverId
    clientId = AjxTimezone._SERVER2CLIENT[clientId];
    rule = AjxTimezone._CLIENT2RULE[clientId];
    }
    if (!rule && tz) {
    var names = [ "standard", "daylight" ];
    var rules = tz.daylight ? AjxTimezone.DAYLIGHT_RULES : AjxTimezone.STANDARD_RULES;
    for (var i = 0; i

  7. Julien Lecomte Post author

    @kevin

    Thanks a lot for reporting this (btw, your snippet apparently got truncated) I will fix this in the upcoming version of the compressor (should be available within the next few weeks)

  8. KevinH

    Great! Yes it appears the example got truncated. If you need the full example I can email it to you.

Comments are closed.