Skip to content

Instantly share code, notes, and snippets.

@cemerick
Created April 5, 2011 19:06
Show Gist options
  • Save cemerick/904285 to your computer and use it in GitHub Desktop.
Save cemerick/904285 to your computer and use it in GitHub Desktop.
(require 'clojure.string)
(defn- minify-css
"Because I've already got google closure working for the js, and don't want to
bother with YUI compressor too just for CSS."
[css]
(-> css
(clojure.string/replace #"[\n|\r]" "")
(clojure.string/replace #"\s+" " ")
(clojure.string/replace #"\s*:\s*" ":")
(clojure.string/replace #"\s*,\s*" ",")
(clojure.string/replace #"\s*\{\s*" "{")
(clojure.string/replace #"\s*}\s*" "}")
(clojure.string/replace #"\s*;\s*" ";")
(clojure.string/replace #";}" "}")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment