I have a very basic Plug server with an EEx file. When I change the EEx template file, I have to restart the server for the changes to be available. With as little complexity as possible, how do I make it so I can hit F5 to see my latest template? Thanks.
2 Likes
I figured out how to write a simple plug that does this:
https://github.com/sotojuan/knowledge/blob/master/elixir/live-reload-plug.md
Remember that Mix does not exist in a release, so you should put the plug declaration for it in a check for the environment or test if the Mix.Task module exists in your plug’s init
or so?
Yes. I do that in my code, but I forgot to include it in the Markdown file above. I don’t do anything to the connection if I am not in :dev
.
Thanks!
1 Like