Minify your CSS

Online CSS Minifier/Compressor. Free! Provides an API. Simple Quick and Fast.

Digital Ocean

Written and hosted by Andrew Chilton (@andychilton).

We recommend Digital Ocean for hosting your sites. Free $10 credit when you sign up.

Ruby

Thanks to Jeremy Cron for contributing this example.

require "rest_client"

task :minify do
  css_file = "public/stylesheets/main.css"
  css_min_file = "public/stylesheets/min/main.min.css"
  response = RestClient.post "https://cssminifier.com/raw", {:input => File.open(css_file).read}
  File.open(css_min_file, "w").write(response)
end

Language Examples

Click on the language of your choice:

wget Curl Node.js Python Ruby Perl PHP C#

More Languages

I'd love to add more examples in your favourite programming language, so feel free to send them my way. Email andychilton at that gmail place in the sky or tweet to me @andychilton.