I'm looking for some applications or websites that minimize css and js files. Ideally, they could batch them all or if not, one at a time.
What are some good css and js minimizers for production code?
21.2k views Asked by Brian AtThere are 12 answers
Take a look at The JavaScript CompressorRater. It does live comparisons of various minifiers (with and without gzip compression) for any JavaScript you supply it.
It also (mostly) works with CSS, though not all minifiers support it and not even all of those that do (e.g. YUI) show up correctly in the comparison table.
If you don't mind using Perl as part of your build process, JavaScript:: and CSS::Minifier work pretty well.
YUI compressor is great.
Another tool (and my weapon of choice due to its PHP-ness) is the PHP5-based Minify project hosted on Google code. If you're on a PHP platform consider it. Rather than running your stuff through a service after the fact, you install and configure this on your webserver once and then code and comment as much as you want and minify will rebuild (reminify) your CSS and/or Javascript on the fly. Yeah. I've used it, works great!!
Microsoft released their Microsoft Ajax Minifier on codeplex today. Includes an MS build task and everthing inside VS 2005/2008
There's also a .NET port of YUI Compressor which allows you to:-
- intergrate the minification/file combining into Visual Studio post-build events
- intergrate into a TFS Build (including CI)
- if you wish to just use the dll's in your own code (eg. on the fly minification).
YUI Compressor does both JavaScript and CSS. I'm not sure if you can send it a batch of files.
You can batch process at YUI Compressor Online (yui.2clics.net), though that version only accepts JavaScript. Another Online YUI Compressor (refresh-sf.com) accepts CSS, too, but doesn't batch.
In terms of comparing the various minifiers, see jQuery : Frequently Asked Questions (FAQ) : How do I compress my code? Also, check out Microsoft Ajax Minifier.
jQuery has switched from the YUI Compressor to Google's Closure Compiler for the minified version that they distribute.