Can watch dust file, but content doesn't change
Closed this issue · 1 comments
Castafiore commented
I am using dust
as template engine in my express project. I wrote code below:
var lrserver = require('livereload').createServer({
exts: ['html', 'dust', 'css', 'js', 'png', 'gif', 'jpg', 'jpeg', 'svg']
});
lrserver.watch([path.join(__dirname, 'public'), path.join(__dirname, 'views')]);
When I run my project and visit one page, I change some stuff in the corresponding dust file and save it, I can see the page refresh, but the content doesn't change.
Can anybody help me?
Castafiore commented
Finally I've found the reason in official documentation below:
http://krakenjs.com/adaro.html
app.engine('dust', adaro.dust({
cache: false,
helpers: [
'dustjs-helpers',
'dustjs-helpers-extra'
]
}));
The property cache
is defaults to true. Setting it to false will disable caching of templates in the dust cache.
In order to make dust file content change reflect on page, we need to set cache to false.