Fork me on GitHub
#boot
<
2018-06-15
>
minikomi05:06:29

This might be useful for someone. I had problems with boot-cljs slowing down my build when I was trying to iterate writing styles using garden & having the styles reload in the browser.

(defn switch [switch-atom switched-task]
  (let [init (atom true)]
    (fn [next-handler]
      (fn [fileset]
        (if (or @init @switch-atom)
          (do (reset! init false)
              ((switched-task next-handler) fileset))
          (next-handler fileset))))))
Used in a pipeline like:
(def cljs-every-build (atom false))

(deftask build-frontend
  []
  (comp
   (build-styles)
   (switch cljs-every-build (cljs))))

minikomi05:06:52

You can reset the atom from the repl, turing that task on or off.

pithyless11:06:55

@seancorfield - IIRC you mentioned once working on a monorepo system with sub-projects having their own deps, etc. and gluing it all together with boot. Have you got a gist or writeup somewhere to share some of those details? Or anyone else for that matter šŸ™‚ Iā€™m specifically interested in working with a monorepo where each project could theoretically have its own deps (clj / cljs / npm) and generate its own artifacts. Not sure if its a good idea, thoughts?

seancorfield15:06:43

@pithyless yes we are working on that but it's slow progress because it all works already with boot and other things are higher priority. We have a branch where the first few subprojects in the monorepo have been converted.