Closed MikeDombo closed 6 years ago
Not sure we will be able to fix that. Mostly with pugjs
option enabled. I recommand you to use the cache only for production environment. And use ->cacheDirectory
to cache all templates when you deploy your app in production, then you would be able to set upToDateCheck
to false to optimize performance and have no check at all of which files changed.
And in development, if you disable the cache, you're sure what you see is always up to date.
The renderer version 0.2.17 handle cache extend/include expiration.
So this feature is now available on the default mode (PHP engine). I will check if we can do something for pugjs
option too.
Hi,
I finally decide not to implement a special cache strategy for pugjs but, now you can set up you own strategy:
For example, you can compare cachedFile last modified time against the directory of the sourceFile.
$pug = new Pug([
'pugjs' => true,
'pugjs_cache_check' => function ($cachedFile, $sourceFile, Pug $pug) {
if (!file_exists($cachedFile)) {
return false; // not up to date
}
return filemtime($rcachedFile) > filemtime(dirname($sourceFile));
},
]);
The default behavior is:
return file_exists($renderFile) && (
filemtime($renderFile) >= filemtime($filename) ||
!$pug->getDefaultOption('upToDateCheck')
);
I hope you can work around with this.
Hi, I have code like
I also have caching enabled using the pugjs renderer. When I change
mixins.pug
the change does not propagate to my main file that includes the mixins.