Serve A Local Directory As A Web Site With Auto-Reload via browser-sync
npm install -g browser-sync
Then CD into the directory you want to serve and do this:
browser-sync . -w --no-notify
That will serve the directory with the watch files flag set which makes the browser reload automatically on changes.
--no-notify turns off a banner that would otherwise flash during each update
You can serve a local directory as a web site by running this inside it:
npx browser-sync start --server --files "./**/*.html" --no-open --no-notify --directory
This will automatically reload the browser if it seems any of the .html files change.
The site is served at both:
Use ngrok if you need to show it to folks externally by running this (doesn't have to be in the same directory):
ngrok http 3000
There's also a UI that gives you some details at:
npx installed which should come with node.
It'll install browser-sync the first time you run it if it's not already there.