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

Add file watcher for development with live reload #7

Merged
merged 10 commits into from
Dec 13, 2023

Conversation

goncalotomas
Copy link
Contributor

@goncalotomas goncalotomas commented Dec 6, 2023

  • Make mix grf.server build when starting
  • Watch for changes in the input directory and call mix grf.build every time a file is modified.
  • Watch for changes in the layouts directory and call mix grf.build every time a file is modified.
  • Use plug_live_reload to reload pages automatically when changes are detected in the output files.
  • Rewrite HTTP Server to use Plug.Router but not Plug.Static so that Live Reload works
  • Fix or suppress lint issues (we are now using credo, had forgotten to add it)
  • Remove all Application related code, spawn required processes from within grf.server
  • Allow changing HTTP port via -p, --port CLI option

This makes it so that when a user changes a file, it will first be picked up by the file watcher, rebuilt into a new version of the file in the output directory which is then picked up by plug_live_reload.

There was an issue with the old way grf.server was being started that was not allowing live reload to happen which I still need to dig into a bit more.

@goncalotomas goncalotomas self-assigned this Dec 6, 2023
@goncalotomas
Copy link
Contributor Author

goncalotomas commented Dec 12, 2023

Things are starting to take shape but there are still a couple of things to do:

  • Make Watcher watch for changes in layouts directory aside from input directory
  • Rewrite HTTP Server to use Plug.Router but not Plug.Static so that Live Reload works
  • Fix or suppress lint issues (we are now using credo, had forgotten to add it)

@goncalotomas goncalotomas merged commit f1a2b0a into main Dec 13, 2023
1 check passed
@goncalotomas goncalotomas deleted the add-file-watcher-for-development branch December 13, 2023 22:48
@goncalotomas
Copy link
Contributor Author

@lcmen perhaps not too late, but we finally have a server that watches file changes and it even live reloads! 😄

@lcmen
Copy link
Contributor

lcmen commented Dec 31, 2023

@goncalotomas thanks for the heads-up! Unfortunatelly, I've settled on Jekyll for now.

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.

2 participants