Skip to content

Instantly share code, notes, and snippets.

@dominicmartineau
Created April 29, 2013 17:48
Show Gist options
  • Select an option

  • Save dominicmartineau/5483359 to your computer and use it in GitHub Desktop.

Select an option

Save dominicmartineau/5483359 to your computer and use it in GitHub Desktop.
Minify a CSS file with sed.
cat styles.css | sed -e 's/^[ \t]*//g; s/[ \t]*$//g; s/\([:{;,]\) /\1/g; s/ {/{/g; s/\/\*.*\*\///g; /^$/d' | sed -e :a -e '$!N; s/\n\(.\)/\1/; ta' > styles.min.css
@djanowski

Copy link
Copy Markdown

Hi Dominic! Can you please add a license to this snippet so that I can reuse it in a library? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment