I can't get hot reloading to work with clojure code. Here's my build
^{:watch-dirs ["src/cljs", "src/clj"]
:reload-clj-files [:clj]
:ring-handler com.example.server/app
:css-dirs ["resources/public/css"]}
{:main com.example}
It fails because figwheel does not accept src/clj
as watch folder, since there are no .cljs files there. Did somebody get it to work?@roti figwheel doesn't support reloading clj
files directly. It automatically reloads only those that contain macros used by the cljs
files.
so adding "src/clj" to the :watch-dirs won't work
take a look at https://github.com/weavejester/ns-tracker
and also here https://github.com/clojure/tools.namespace#reloading-code-motivation
@roti I wrote a small library for this. The code is quite simple and based on what fighweel does. Maybe you can just take the code from core.clj rather than depend on the lib if you'd like: https://github.com/thiru/clj-reloader
Nice!
btw, your comment regarding unloading code https://github.com/thiru/clj-reloader/blob/master/src/reloader/core.clj#L94
that's exactly what clojure.tools.namespace.*
provides -> loading and unloading code.
@roti here is a proof of concept that uses figwheel.main.watching
and clojure.tools.namespace.*
. You already have them as dependencies. https://github.com/dimovich/deps-cider-cljs-reagent/blob/watch/watch.clj
Start it like this: https://github.com/dimovich/deps-cider-cljs-reagent/blob/watch/deps.edn#L22