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

我们两清 提交于 2019-11-29 15:46:50

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).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!