boot

:boot-clj: https://boot-clj.github.io/ — build tooling for Clojure. Dev chat in #boot-dev
respatialized 2019-11-29T20:41:29.044700Z

Hey, #boot ! I'm having trouble with the watch task when trying to generate content for perun dynamically. I use clojure2d to generate images on the fly and then refer to those images using hiccup data structures that perun's boot tasks render into HTML. This works fine for one-off builds. The problem: an infinite loop when boot watch is part of the dev cycle. I have adapted one of the perun examples like so:

(set-env!
 :source-paths #{"src"}
 :resource-paths #{"content" "resources"}
 :asset-paths #{"output"}
...)

(deftask dev
  "Build and serve the perun content locally."
  []
  (comp (watch :exclude #{#"output\\/*"})
        (build)
        (serve :resource-root "public")))
The images I'm trying to display get generated from the functions called in /src, and written to /output. No matter what I do, watch always picks up the images after they write, resulting in an endless re-render cycle. I'm trying to arrange it using :exclude so that the build/watch cycle renders the content from clojure2d functions defined in /src every time they change, but the output images are in a directory that is ignored by watch so that it doesn't trigger this loop. I haven't yet had much success. Is this as simple as not regexing the path properly? I tested using re-match in the REPL but I don't know if adding a dir to the Boot environment via set-env overrides :exclude in watch.

1