Local development with hot reload #210
jeromegamez
started this conversation in
Show and tell
Replies: 1 comment 3 replies
-
After having worked with this for a few days I can say it makes things a little less cumbersome but it's far from perfect. For example: if I close the terminal window before stopping the script first, the processes keep running; when I restart the watcher in a new window, it fails with telling me that the ports are already occupied. I will update the code snippet as I try to make it better, and if you notice something that could/should be made better, please do let me know ^^. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey there 👋🏻,
I'm currently tinkering with Framework X and was wondering if there was a better way than stopping and re-running
php public/index.php
each time I made a change.I tried 3rd party tools like entr but didn't get it to work properly, so I asked myself if I couldn't do it with ReactPHP.
I came up with this (hopefully simple and certainly flawed) file/directory watcher using
reactphp/child-process
:If stored the script as
bin/develop
(andchmod +x
ed it), so I can run it withbin/develop
when I start working and don't have to keep an eye on it.You can probably imagine how it works but here's a demo anyway:
hot-reload-demo.mp4
Perhaps it can be useful to someone else, and I'm very much looking forward to your feedback and suggestions 🙏🏻
Beta Was this translation helpful? Give feedback.
All reactions