user2650480
user2650480

Reputation: 489

change jade always require node.js restart then can verify the change

I'm using Jade as template engine at node.js. I have to stop node.js and start whenever I made changes to Jade file so I can verified the change. Is there tool or a way that if I made change to Jade I don't need to restart node.js app?

Upvotes: 2

Views: 882

Answers (1)

robertklep
robertklep

Reputation: 203554

Changes to Jade templates should be picked up automatically after you reload the page, at least in development mode.

If not, then the most likely cause is that view caching is enabled in Express, which is the default if the NODE_ENV environment variable is set to production, or caching is explicitly enabled.

To explicitly disable view caching, you can use this:

var app = express();
...
app.set('view cache', false);
...

However, this will carry a performance impact when you're running in production, as the template file will be processed for each request. Therefore, you should really try to find out why exactly Express is caching your templates (as said, the most likely culprit is NODE_ENV not being set correctly for a development environment).

Upvotes: 6

Related Questions