简体   繁体   中英

Can Figwheel evaluate ClojureScript code when a resource file changes?

I have a macro that slurps a markdown file from resources. It provides a convenient way to provide some content. But when I edit the markdown file, Figwheel has no way to know that it needs to re-evaluate the macro.

Putting the markdown in a string inside a cljs file is undesirable because strings with newlines get indented by most Clojure editors, and this causes the markdown to be incorrect (leading spaces are meaningful in markdown).

Is there a way to detect/refresh when the markdown file changes? Or a better solution?

Here is a basic example of what I am trying to do: https://github.com/timothypratley/figwheel-watch-markdown-example

Figwheel's configs allow you to add ::watch-paths which trigger reloading when modification events come up from the file system. You can also use ::hawk-options to poll the files looking for changes, which apparently might be necessary in some environments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM