-
Notifications
You must be signed in to change notification settings - Fork 30
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
Reload code on refresh without server restart #20
Comments
Does this implemented? I tried and it didn't work. Ok. LOL. Found in the code that do the same thing with the same tool. |
Yeah entr is great! I'm still not quite sure how I'd do this. It would be nice to start a websocket server and push updated html to the page you're working on, something like "hot reload" but I'm not sure if I care about the server reloading without restarting since restarts are so fast. |
Are there any updates on this? Maybe there is a way to at least refresh a browser tab when the code changes. |
I did manage to whip something up to refresh the tab, but the websockets thing would be cross platform/cross browser. Here is what I did on macOS. I created two files, watch looks like this: #!/usr/bin/env sh
pkill -xf "janet src/app.janet"
sleep .5
janet src/app.janet &
osascript refresh-tab.scptd refresh-tab looks like this: #!/usr/bin/osascript
tell application "Safari"
set docUrl to URL of document 1
set URL of document 1 to docUrl
end tell and then it gets called via fswatch which I wrapped up in a (phony "watch" []
(os/shell "fswatch -o . --exclude='.git' --exclude='.sqlite3' | xargs -n1 -I{} ./watch")) I think I will take another shot at using websockets to reload html on the page with |
I noticed that generating a fresh app contains (phony "server" []
(if (= "development" (os/getenv "JOY_ENV"))
(os/shell "find . -name '*.janet' | entr janet main.janet")
(os/shell "janet main.janet"))) I'm pretty sure that it is because when it calls (use joy)
(phony "server" []
(if (= "development" (env :joy_env))
(os/shell "find . -name '*.janet' | entr -r janet main.janet")
(os/shell "janet main.janet"))) Instead of using |
No description provided.
The text was updated successfully, but these errors were encountered: