Created
April 29, 2013 17:48
-
-
Save dominicmartineau/5483359 to your computer and use it in GitHub Desktop.
Minify a CSS file with sed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Dominic! Can you please add a license to this snippet so that I can reuse it in a library? Thanks!