is there any way to run a function when I send a form from my editor (VSCode/calva) to nbb? I’m basically looking for some quick server side react-based rendering and I want to refresh on eval
I'm not sure if this is a Calva or nbb question
I thought there might be some generic nbb mechanism to do that
I'm not sure what or how that would work, perhaps you can chop up the question into sub-problems
or perhaps @pez has an idea from the calva side
right. So, ultimately I want a cljs script that runs with nbb and spits out some html into a file. I'd like that script to also run a http server to serve the said file and reload the browser when that file changes. The latter is reasonably doable with some npm (e.g. refresh). But I'd have to call into refresh from the repl to actually tell it to refresh, and I'd like for it to refresh on every form change, e.g. if I build that html with nbb's Reagent, I want it to refresh when I send new subelements from the editor to the REPL.
I think I could use joyride to make a new vscode hotkey that uses the calva API to evaluate the top-level form and then the command to refresh the page... actually I might try just that.
I think sitefox mostly satisfies my case. It reloads when cljs is saved. That's good enough https://github.com/chr15m/sitefox/blob/main/create/sitefox-nbb/template/server.cljs#L41
I found the watch-files reloading a bit buggy (it would occasionally just stop reloading after a while) but I could never figure out why. Hopefully it works better for you. If you run into any problems please feel free to file an issue against Sitefox.