Any recommendations for a CSS minifier?
I’ll be rooting around Google and trying some out, but I suspected that the smart, proficient and curiously handsome StackOverflow community might have already evaluated the pros and cons of the heavyweights.
Any recommendations for a CSS minifier?
I’ll be rooting around Google and trying some out, but I suspected that the smart, proficient and curiously handsome StackOverflow community might have already evaluated the pros and cons of the heavyweights.
The YUI Compressor is fantastic. It works on javascript and css. Check it out.
There's also a .NET port of YUI Compressor which allows you to:-
If you want a web tool solution try Pretty Diff tool. http://mailmarkup.org/prettydiff/prettydiff.html
If you are looking for an online tool, try this: http://www.csscompressor.com/
If you use Python I would recommend slimmer which is probably not as fast as YUI Compressor but unlike csscompressor.com it doesn't choke on CSS hacks.
I'm biased since I wrote slimmer and I'm currently evaluating YUI Compressor to see how it handles hacks. An example of slimmer in action can be seen if you view the source of crosstips.org
I've written an ultra fast CSS minifier in C#. The algorithm does not handle Javascript though. Thy this: http://www.ko-sw.com/Blog/post/An-Ultra-Fast-CSS-Minify-Algorithm.aspx.
If you're looking for something in PHP, here's the link:-
Although it's part of the PHP Fat-Free Framework, it can also be used stand-alone.
I find that isnoop's CSS SuperScrub works very well. It can only handle direct links to CSS online though :/ You can get around that though by using your preferred pastebin service to hold the css code and just giving SuperScrub the raw link.
An online tool (much better than www.csscompressor.com which jacked my css up): http://www.cssdrive.com/compressor/compress.php does an excellent job.