Skip to content

Instantly share code, notes, and snippets.

@kurtharriger
Created March 23, 2014 02:52
Show Gist options
  • Save kurtharriger/9717936 to your computer and use it in GitHub Desktop.
Save kurtharriger/9717936 to your computer and use it in GitHub Desktop.
Clojure script to strip classes from html
(require '[net.cgrand.enlive-html :as html])
(defn render [e] (apply str (html/emit* e)))
(defn strip-classes
"Remove class attribute from all elements"
[file]
(->
(html/html-resource file)
(html/at [(html/attr? :class)] (html/remove-attr :class))
(render)))
;; (spit "clean.html (strip-classes "index.html"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment