Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(set-env!
:source-paths #{"src"}
:resource-paths #{"html"}
:dependencies '[[adzerk/boot-cljs "2.1.3" :scope "test"]
[adzerk/boot-reload "0.5.2" :scope "test"]
[org.clojure/clojurescript "1.9.908"]
[pandeiro/boot-http "0.8.3" :scope "test"]])
(require
'[adzerk.boot-cljs :refer [cljs]]
'[adzerk.boot-reload :refer [reload]]
'[pandeiro.boot-http :refer [serve]])
(defn guard-task
[regexes task]
(let [prev (atom nil)]
(fn [next-handler]
(fn [fileset]
(let [diff (fileset-diff @prev fileset :hash)]
(reset! prev fileset)
(if (seq (by-re regexes (input-files diff)))
((task next-handler) fileset)
(next-handler fileset)))))))
(deftask dev []
(set-env! :source-paths #{"src" "test"})
(comp (serve)
(watch)
(speak)
(reload :on-jsload 'app.core/main)
(guard-task [#"\.cljs$"] (cljs :source-map true :optimizations :none))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment