Skip to content
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

Set up hot module reloading #7

Merged
merged 3 commits into from
Feb 13, 2024
Merged

Set up hot module reloading #7

merged 3 commits into from
Feb 13, 2024

Conversation

haydenrou
Copy link
Contributor

@haydenrou haydenrou commented Feb 10, 2024

  • Updates the README
  • Adds a Makefile to simplify running local development
  • Enables hot module reloading (or more specifically just adds a make command to run it)

Options for hot module reloading suggested by Templ are as follows:

  1. Built-in support using the committed command. It seems slightly slower than Air but allows for page reloads on save through a proxy. *
  2. air - I liked this but it doesn't offer the proxy, perhaps that's not a dealbreaker?
  3. wgo - same, but far less popular / used.
  • The reload on save doesn't seem to currently work for me, potentially due to the following error: Proxy to target error: http: proxy error: max retries reached. I've mentioned this in the following issue, and the current workaround is just manually reloading for changes to templ files. Changes to Go files seem to require a restart at the moment. Panic on proxy argument when running generate --watch a-h/templ#381 (comment)

Another option is https://github.com/jdudmesh/gomon but I'd rather go with one of the above as they seem a bit more popular.

If the proxy is temperamental or not a blocker then I'm tempted to use air instead as it seems a little nicer from a configuration perspective, but I think we could follow up with this.

Closes #1

@haydenrou haydenrou self-assigned this Feb 10, 2024
README.md Show resolved Hide resolved
@haydenrou haydenrou changed the title WIP: Set up hot module reloading Set up hot module reloading Feb 11, 2024
@haydenrou haydenrou marked this pull request as ready for review February 11, 2024 16:56
@haydenrou
Copy link
Contributor Author

@jonnyjones99 @codemonium are you opposed to me pushing this up as is to get the updated readme and makefile up?

I am thinking about creating a low priority bug issue which we can look more into the issue described in the PR description, however I don't think it's a blocker for getting something as simple as this out.

@haydenrou haydenrou merged commit 824d236 into main Feb 13, 2024
@haydenrou haydenrou deleted the hmr-templ branch March 4, 2024 13:41
@haydenrou haydenrou added this to the MVP milestone May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set up hot module reloading for Templ
3 participants