-
-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: hot reload, fixes #82 #130
Conversation
Worth a look, github have a fork of the browser package imported in this PR that is actively maintained and updated: |
I'm getting fairly happy with this now. I've been doing some work to reduce the CPU utilisation, since I noticed it was using a lot of CPU while watching. I added profiling, and noted that walking the directory every 250ms caused a lot of syscalls, and switched to However, I think it's still too much. Next, I thought that I'd try out a phased approach:
|
It would be more work to maintain, but you could use a separate technique for systems that support inotify rather than polling. Or if you're willing to take on another dep: |
I tried out using fsnotify and friends, but couldn't get it to work well on my machine. Here's an abandoned branch - https://github.com/a-h/templ/tree/hot_reload_watcher I'm not sure I want to support the weird errors I'll get with a filesystem watcher implementation, since it requires me to have a machine for each OS and to test it out. |
* wip: hot reload, need to work on client side element * wip: get the proxy to reload the page * refactor: switch to Github's fork of github.com/pkg/browser * refactor: split up into smaller packages * feat: add HTTP profile * fix: ensure that commands are cancelled * refactor: use the more efficient WalkDir method to reduce needless syscalls * refactor: ensure cancellation works well * feat: use backoff to reduce CPU utilisation * docs: add new templ generate docs
No description provided.