-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pug includes used only in other _includes trigger a re-render on --watch but aren't processed. #3
Comments
|
Tried with both, and neither wanted to save more than once. I also ran the tests with nunjucks - worked as expected. I ran another test using Pugs extends/blocks instead of the eleventy system. That all works 100%. Renders any length of child templates with extends/blocks no problems. It's just Pug and nested includes. It won't save more than once with --incremental, or without. Here's my test setup for the bug: /test-page.pug - page
/_includes/test-layout.pug - parent include
/_includes/test-include.pug - child include
If you edit and save the child include then it won't update even though it triggers a file change on watch. If you then go to edit and save page it still won't update. If you edit and save the parent include it will finally update the template with the current child include. Seems that any _include/ file that uses another _include/ file won't fetch a fresh render of it in Pug using --watch unless it's refreshed itself. You can see this behaviour by adding an include for the child include to the page as well. The page will always have the freshest version while continuing to display the old version until the parent include is refreshed. |
(Psst! This Issue should be tagged with |
I'm not using any includes but I think I'm experience either the same or a similar issue using pug's
where macOS 13.3.1 (a) |
It seems to me it should be tagged as a bug. |
I'm not sure about elegance but it works. In the //return this.pugLib.compile(str, options);
const renderFunc = (locals) => {
const compiledFunc = this.pugLib.compile(str, options)
return compiledFunc(locals)
}
return renderFunc |
Are there any news on this issue? I am also experiencing it. The watch detects the change, but the output file doesn't update. It definitely looks like a bug. Edit: I can confirm the suggestion of @atolk works as expected. Here is the patch file for patch-package: @11ty+eleventy+2.0.1.patch |
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.
@zachleat There's a patch suggestion above. Can you review? |
Operating system
Windows 11
Eleventy
v2.0.0-canary.28
Describe the bug
If an _include file (nav.pug) that is used in another _include file (default.pug) is changed, and it's not used anywhere outside of _includes, then when Eleventy rebuilds it does not re-render the first include (nav.pug) when it updates the second (default.pug).
This means using a component layout with _includes in Pug, if the include is not directly used by something outside the directory you have to force a full render to work on the file.
What makes this bug insidious is that the first time you save the file with --incremental --ignore-initial it DOES render.
Reproduction steps
h2 Include Test
include ./_include/test.pug
p Layout Test
. It will trigger watch as expected, adding in the new element.p Include Test
. This will trigger watch and add an element as expected.p Layout Test2
. It will trigger watch as expected, adding in the new element.p This is the second save.
. This will trigger watch but nothing will appear.p Layout Test3
. This will trigger watch and add the "Layout Test3" text but the "second save" text from test.pug will still not appear.Expected behavior
It's expected that when you trigger a re-render with --watch that the code is included!
Reproduction URL
No response
Screenshots
No response
The text was updated successfully, but these errors were encountered: