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.
Thanks! Brian
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.
Thanks! Brian
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 this entry from the jQuery FAQ:
How do I compress my code?
Generally the best way to do it is to use the YUI compressor.
An alternative is to use Douglas Crockford's JSMin. This doesn't compress JavaScript code as small, but generally how you write your code matters less. jQuery also provides a pre-minified version of jQuery for your convenience.
Packing javascript using Dean Edwards' Packer (specifically using the base64 encode) is not recommended, as the client-side decoding has significant overhead that outweighs the file-size benefits.
If compressing your JavaScript breaks it, try running the code through JSLint. This will detect minor errors that can cause packed JavaScript to fail where the unpacked version works fine.
Since that was writter Microsoft release their Ajax Minifier and Google their Closure Compiler. jQuery has switched from YUI Compressor to the Closure Compiler for the minified version that they distribute.
YUI Compressor is pretty cool. You can run it as part of a build process from the command line
I like this one from Yahoo: http://developer.yahoo.com/yui/compressor/
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.
There's also a .NET port of YUI Compressor which allows you to:-
Microsoft released their Microsoft Ajax Minifier on codeplex today. Includes an MS build task and everthing inside VS 2005/2008