Tuesday, August 28th, 2007
Keep on squeezing with YUI Compressor
<p>Julien Lecomte keeps rev’ing his new YUI Compressor with a 2.0 release.What’s new?
I am very pleased to announce the release of version 2.0 of the YUI Compressor. In addition to fixing several bugs and implementing a few enhancements suggested by the community, I also integrated Isaac Schlueter’s regular expression based CSS minifier. Therefore, the YUI Compressor is now able to compress both JavaScript and CSS files (see the CHANGELOG for a full list of changes) And as always, keep the feedback coming!
Related Content:











Minified CSS has been a long missing feature of the web. I’ve bitched about it to Dojo before and they said that they’d consider it for Dojo 1.0.
@Em – Not really. Check out: http://csstidy.sourceforge.net/
@Marat
csstidy uses a traditional parser to parse a css style sheet. This makes it ignore some hacks that people commonly use to work around browser inconsistencies and that it does not recognize i.e. the output style sheet may be different from the original one and csstidy might have introduced bugs in the process.
@Em – I agree with Marat. Also check out http://code.google.com/p/minify/
Also, Minifying CSS is simple, just perform a big regex on the CSS. This technique has always been available, although most people still aren’t doing it.
@Julien – most CSS minify-ing parsers remove the comment hacks, but allow the rest. I think the comment hack is actually now outdated, and I’ve never found a situation where I’ve HAD to use one (many other techniques are now well known). Plus, I suppose one could go around minifying old hacked CSS, but if one is updating a site, why not update the hacks as well? Less hacks always leads to better future compatibility.
@Marat:
Thanks for the link. Such tools didn’t come up in my early days of searching.
Version 2.1 is out and available on my blog:
http://www.julienlecomte.net/
FYI, it seems latest version of JavaScript Obfuscator from Stunnix can optionally use a modified version of YUI Compressor (it can handle several files at once after their mods) and can compress JavaScript using YUI Compressor inside html files too.