figwheel-main

cjohansen 2023-03-05T12:56:57.959409Z

I have a development setup where I use a CSS file inside an iframe. It doesn't seem like figwheel-main is able to reload this CSS file. Is it possible to help figwheel find it somehow, or is it possible to hook into the reload? If my code can know when it happens, I can facilitate the reloading.

cjohansen 2023-03-05T20:25:16.131899Z

Checked out the source, and found that figwheel conveniently dispatches a custom event:

(.addEventListener
   js/document.body
   "figwheel.after-css-load"
   (fn [e]
     (prn "CSS files loaded" (:css-files (.-data e)))))
One caveat is that the event is only dispatched if the CSS was found in the document. I didn’t really want that, so I added it to the document with media="print" to load it without it taking effect. I’d be happy to make a PR to dispatch the event in any case. Any interest?