bmustiata / fast-live-reload

A live reload that works with all the possible browsers.
18 stars 5 forks source link

How to combine fast-live-reload with nodejs server? #7

Closed heinhoang closed 6 years ago

heinhoang commented 6 years ago

"fast-live-reload": "^2.7.6" (npm i -D fast-live-reload)

I use express-generator to generate nodejs app (it's using handlebars). The app runs on http://localhost:3000 I want to hot-reload css/js after changing css/js in public folder. So, how to do that? I setup likes this fast-live-reload http://localhost:3000 and this fast-live-reload -s ./public/ -p 3000 but it's not working

bmustiata commented 6 years ago

You have 2 options.

1

Using remote locations

fast-live-reload can serve local content, or proxy a site, and inject the reloading script into it. If you don't have some fancy redirect to the original site for security, you can just:

flr -s http://localhost:8000/ ./public

2 Manually injecting the client javascript

If you do have redirects, you can manually insert the reloading script (you can get it with bower install fast-live-reload), and then:

flr -ns ./public

This won't start any server to serve content, except the reloading one.