figwheel-main

figwheel-main http://figwheel.org
roti 2019-08-24T09:24:16.058800Z

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?

2019-08-24T12:29:07.059700Z

@roti figwheel doesn't support reloading clj files directly. It automatically reloads only those that contain macros used by the cljs files.

2019-08-24T12:29:30.060100Z

so adding "src/clj" to the :watch-dirs won't work

2019-08-24T12:29:35.060300Z

take a look at https://github.com/weavejester/ns-tracker

thiru 2019-08-24T15:18:43.066Z

@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

2019-08-24T17:45:24.066200Z

Nice!

2019-08-24T17:45:40.066400Z

btw, your comment regarding unloading code https://github.com/thiru/clj-reloader/blob/master/src/reloader/core.clj#L94

2019-08-24T17:46:05.066700Z

that's exactly what clojure.tools.namespace.* provides -> loading and unloading code.

2019-08-24T22:25:21.068700Z

@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