Any recommendations for a CSS minifier?

Viewed 80573

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.

21 Answers

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:-

  • 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).

UPDATE 2011: And it's now available via NuGet also :)

I like Minify. In PHP and works with CSS or JavaScript.

Try closure-stylesheets.

Beside minification it also supports linting, RTL flipping, and class renaming.

It can also add variables, functions, conditionals, and mixins to CSS.

Also note that some of these features depend on rest of Closure Tools (which are very powerful on their own).

If you're looking for something in PHP, here's the link:-

Fat-Free Minify

Although it's part of the PHP Fat-Free Framework, it can also be used stand-alone.

Related