Skip to content

Instantly share code, notes, and snippets.

@dimovich
Created September 10, 2019 16:10
Show Gist options
  • Save dimovich/20eb3b40b7ee6e6d6fc8155e25c52e1e to your computer and use it in GitHub Desktop.
Save dimovich/20eb3b40b7ee6e6d6fc8155e25c52e1e to your computer and use it in GitHub Desktop.
compile Sass when using figwheel-main
;; use with deps.edn
;; {:aliases {:sass {:main-opts ["-i sass.clj -m figwheel.main -b dev"]}}}
(require '[clojure.java.shell :as sh]
'[figwheel.main.watching :as fww])
(println "watching Sass...")
;; change comand and location of sass files as needed
(defn compile-sass [_]
(sh/sh "sass" "sass/main.sass:resources/public/css/main.css")
(sh/sh "postcss" "resources/public/css/main.css" "-u" "autoprefixer"
"-o" "resources/public/css/prefixed-main.css"))
(fww/add-watch!
:sass
{:paths ["sass"]
:filter (fww/suffix-filter #{"sass"})
:handler (fww/throttle 50 compile-sass)})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment