I have an express app. I am using swig as the template engine. Is it possible to reflect my HTML changes in the browser when I click refresh. I don't want to restart the server every time I need to do a HTML change?
Asked
Active
Viewed 6,444 times
3 Answers
9
I got the solution from this link.
I installed supervisor module as global installation
npm install supervisor -g
I stated my app like this
supervisor -e html,js app.js
Here i am specifying to watch the changes in files with extensions .html and .js. So when these files are changed its automatically reloaded when the next request comes.No restart required.

Akhi
- 2,242
- 18
- 24
-
Where u wrote 'supervisor -e html,js app.js'? Please suggest. mine not working. – Rashid Khan Dec 16 '19 at 13:50
1
There are plenty of tools for this:
And I'm sure you could find more.

Florian Margaine
- 58,730
- 15
- 91
- 116
1
You can simply disable swig's caching:
if (process.env.NODE_ENV !== 'production') {
swig.setDefaults({ cache: false });
}

Domi
- 553
- 4
- 6