Add Live Reload using WebSockets#207
Conversation
* fix nav selector: ".nav" -> "nav" (tag not class) * sync page title and re-init mermaid after swap * move middleware registration to prepare (fix load-time crash) * add LiveReload + Middleware specs (14 examples) * update approval files for new config/cli option * document live_reload in README
|
Thanks. There are issues with this PR that need addressing before I can decide if I want to merge it.
Even if all these are fixed, I am still not sure I want to merge - there is more overhead than I am comfortable with, but if the above is fixed, I can at least start to evaluate. |
|
Hey thanks for feedback! I use it mainly for live preview and editing. I love go-grip but it misses file tree navigation. The test fix should be an easy one. If you are not comfortable maintain WS part, we can close it I can maintain fork for myself because it solves my problem. Let me know your thoughts |
|
Thanks for being cool and understanding about it. My TLDR reply to this would be: Yes, I would feel more comfortable avoiding live reload in madness. The longer rationale is this:
So to sum it up - I would love to have this feature, but not at its current cost. In any event, do not close this PR - as I or someone else may find the motivation to try and reduce its cost. |
|
Thanks for the thoughtful breakdown, makes total sense. I think this can be addressed with polling and or SSE and listen with simple File.mtime polling in a thread. Rack supports SSE streaming natively. One-directional push is all live reload requires. Polling with Dir.glob + File.mtime in a background thread. Works on every filesystem (VMs, Docker, NFS) without platform-specific watchers. Also it can be off by default and enabled with --live-reload or live_reload: true in .madness.yml |
Will this help? https://github.com/DannyBen/watchly If we can mitigate some of the issues, than having live reload becomes much more attractive. |
Adds WebSocket-based live reload support (edited, deleted, created)
What's included
listengem to watch andfaye-websocketto push changes/_live_reload.maincontent andnavsidebarlive_reload: trueby default, disable with--no-live-reloadorlive_reload: falsein.madness.yml