From e50438dbd0a924db7df95fd216fd1db4704dcec0 Mon Sep 17 00:00:00 2001 From: Aaron Schrab Date: Thu, 28 Sep 2023 23:03:35 -0400 Subject: [PATCH] Register dependencies found during pug compilation My main layout is written in pug, and uses an `include` file. When running `eleventy --serve` I noticed that changes to the included file would trigger rebuilds, but not show the changes. This seems to be similar to #2741. Here I fix this by using the list of dependencies that the pug `compile` function includes on the function that it returns. With this I am seeing changes to my included file reflected immediately. --- src/Engines/Pug.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Engines/Pug.js b/src/Engines/Pug.js index 100b0c6f2..4ce73192a 100644 --- a/src/Engines/Pug.js +++ b/src/Engines/Pug.js @@ -35,7 +35,13 @@ class Pug extends TemplateEngine { options.filename = inputPath; } - return this.pugLib.compile(str, options); + const compiled = this.pugLib.compile(str, options); + + if (compiled.dependencies) { + this.config.uses.addDependency(inputPath, compiled.dependencies); + } + + return compiled; } }