Fork me on GitHub
#figwheel-main
<
2020-01-09
>
mikerod16:01:55

Is there a way to get figwheel-main to live reload your html files?

pyrmont07:01:06

@U0LK1552A I think the answer is no but I'm not sure. I don't know the codebase well enough to understand what would happen if the CLJS environment that Figwheel is using were to be reloaded (which is what would happen when the page reloads). If you wanted to try, I think the simplest way would be to edit one of the functions that either watches for CLJS file changes or watches for CSS file changes. If you look at those functions, you see that they have options that specify the file suffixes to watch. At the moment, these are CLJS and JS files (in the case of the watch-dirs) and CSS files (in the case of css-dirs). So if you change the suffixes listed here (https://github.com/bhauman/figwheel-main/blob/b5b21d53dbafeef740175161010496da841f1625/src/figwheel/main.cljc#L146), then if you pass the directory with your HTML files as a watch-dirs option, it should reload, I think. Remember that when you set the watch-dirs option, you also need to manually specify src or wherever you have your CLJS.

pyrmont07:01:48

@U0LK1552A Posted a reply that might point you where to go.

pyrmont07:01:36

Actually, on closer inspection, I'm not sure this would work. The functions involved in reloading the CLJS, will try to evaluate the files which is not what you want. The functions involved in CSS reloading look to update the DOM. I think if you wanted this functionality, you'd probably need to create a new watch process that works similar to the CSS reloading but reloads the entire page.

👍 1
mikerod13:01:16

@UG9H141FX ah thanks that is a detailed explanation! Makes sense to me. It’s not too hard to just reload in this situation at least. I was just curious more than anything. But it makes sense it’s a bit complicated

mikerod16:01:08

eg. the public index.html

dominicm16:01:24

The CSS support is probably worth looking at

mikerod17:01:08

Well css reloading is fine. And there is an option for it. Don’t see one for html files. Maybe could just put them in that watch-dir setting and it may work

dominicm21:01:03

I meant to look at the implementation for it

dominicm21:01:16

It had some clues when I looked at it

mikerod22:01:47

@dominicm ah yes, reading through some of it, haven’t went that far yet