Skip to content

Commit b5aeba8

Browse files
authored
Merge pull request #2 from rodion-k/master
Fix crashing on incorrect templates
2 parents 9eab7f9 + a454edd commit b5aeba8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/Phug/WatcherExtension.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,12 @@ public function watch($interval = 1000000, $timeout = null, callable $callback =
5353

5454
$watcher->setChangeEventCallback(function ($event, $resource, $path) {
5555
if (file_exists($path)) {
56+
$sandbox = Phug::getRenderer()->getNewSandBox(function () use ($path) {
57+
return Phug::cacheFile($path);
58+
});
59+
5660
echo "Changes detected in $path\n";
57-
echo ' - '.(Phug::cacheFile($path)
61+
echo ' - '.($sandbox->getResult()
5862
? 'template cached successfully'
5963
: 'cache failure'
6064
)."\n";

0 commit comments

Comments
 (0)