biff
biff copied to clipboard
Add auto-refresh and heads-up display via htmx
See https://clojurians.slack.com/archives/C013Y4VG20J/p1653324121027299. This would enable a similar workflow as with figwheel/shadow-cljs.
We'd need to establish a websocket connection, similar to what's done in the app.clj file; modify com.biffweb/eval-files! to return the stacktrace if there's an error when reloading code; then modify com.example/on-save so that after reloading code it either sends the stacktrace (on failure) or sends a command to refresh the page (on success).
Here's a quick example of doing this with live.js: https://github.com/jacobobryant/biff/commit/36cfe9b291185c9300239770059fd0e72a2bea05. Something like that could be merged into master. There are at least a couple loose ends to tie up:
- make it work with prod-dev. e.g. change the
include-livejs?function so it checks in some other way. Maybe add a config option with a set of email addresses. If the user's address is in the set, include the livejs script. - would be nice to not print out the request logs from livejs since it does polling. that change might be somewhat involved.
- any downsides of adding the wrap-head + wrap-etag middleware?
- might want to make wrap-etag work with file responses, but not strictly necessary since they already have other headers added, so livejs doesn't need them to have an etag to work.
Finally implemented this: https://github.com/jacobobryant/biff/discussions/188