Normally, when using EJS templates with Express, I don't have to restart the server to see changes I've made to a template. I just make a change to a .ejs file and reload the browser to see my changes.
However, with swig templates (which I very much prefer over ejs), if I make a change to a .html file, I have to restart the server inorder to see my changes reflected in the browser.
Is this a bug, or just a side effect of something else I've overlooked?
I'm not looking for a tool like grunt watch, nodemon, or supervisor, I just want my swig templates to behave more like ejs templates if possible.
As explained in the Swig API Documentation, you can configure Swig to not cache templates.
I use something similar to this:
swig.init({
..
cache : app.get('env') === 'production',
..
});
This will make it only cache compiled templates in the production environment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With