-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Multiple blocks append in child layout block append and includes results in multiple bugs: blocks duplicated, with different orders #1261
Comments
Just for the records: I ran into this aswell and used the same work-around (splittig the file up). I opened #1267, which got closed for good. Your description has a clearer structure. One thing that I'd like to add though, is that includes ( layout.jade
page.jade
inc.jade
page.html <div id="head">
<h1>block head</h1>
<p>Appended by `append head` in `inc.jade`</p> <!-- wrong order, btw -->
<p>Appended by `append head` in `page.jade`</p>
</div>
<div id="body">
<h1>block body</h1>
<p>Appended by `append body` in `inc.jade`</p> <!-- wrong order, btw -->
<p>Appended by `append body` in `page.jade`</p>
</div>
<div id="footer">
<h1>block foot</h1>
</div> |
I wonder how this bug was unnoticed until recently (is it new, maybe?). My team and I can't continue with our developing, until we get this sorted out. We are exactly in @triccardi-systran's use-case to construct our layouts of various parts, so we don't end up with one 5.000 loc layout file. So please excuse me writing about 10 comments in two hours and being a PITA about this. 😄 |
Sorry this has taken so long. Blocks will be totally overhauled as part of the 2.0.0 release. Hopefully that will resolve the bug. |
Do we believe this issue to be closed? I have a layout, which includes a 'view'. The view includes a form and has a The script ends up getting included twice - once under the view (incorrect) and once in the scripts block before the body close tag (correct) This is using gulp-pug ^3.2.0 which seems to pull current ^2.1.0 versions of the parser. If you need more code, I will post but its the same setup and symptoms as above. |
OK, I've written a test and it does look like this is still a problem. |
I have just experienced this bug. It has been report in 2013 first. That was 4 years ago, and it still has not been fixed. |
Yup, still here. |
Very disappointing |
All the block replacement/appending/prepending code needs to be rewritten
IMO. Last I checked, it's full of side-effects. It tries to convert an
AST containing blocks into the equivalent AST without blocks, but in doing
so destroys the original block structure, and it does it over multiple
passes. There's no easy way to see the algorithm's comprehension of your
block hierarchy, so it's tough to debug or even document desired behavior.
It will be easier to reason about if a single pug transformation creates
its own tree-like comprehension of all blocks in all layouts. This single
structure can be dumped, logged, or debugged. Then a single traversal of
the root layout uses this structure to recursively expand blocks in one
pass.
…On Tue, Jan 2, 2018 at 1:17 AM, Mike Slinn ***@***.***> wrote:
Very disappointing
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1261 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAW-uBc5Xx0wkVAzrYSlhu2glpPGVzdjks5tGcn7gaJpZM4BHjUp>
.
|
I've just hit this also and now I am sad. Should this be reopened? |
Need a update |
The following examples are compiled using jade v0.35.0 and today's master (bd6233b).
layout.jade
page2.jade
page1-v1.jade
page1-v1.html
Up to here everything is OK.
page1-v2.jade
page1-v2.html
Issue 1: block append in another block append duplicates the content of the inner block append, in different order furthermore.
page1-v3.jade
page1-v3.html
Issue 2: append order is not the expected one: page 2 should be after page 1 in both script & content blocks.
With manual copy past of page2.jade instead of include page2.jade it works:
page1-v3bis.jade
page1-v3bis.html
page1-v4.jade (include inside append content)
page1-v4.html
Issue 3: block scripts is duplicated like in issue 1, but the order is the same in the two copies...
This seems duplicated each time we append, directly or from an include:
page1-v4bis.jade (page 2 included two times + direct append)
page1-v4.html
I have a use-case for this: a page.jade that extends layout.jade optionally includes multiple features, each feature has a css, scripts & content blocks to append to. Currently I'm forced to split each feature in 3 .jade files, one per block to implement, and include them at the top level of page.jade; but this doesn't work well either because of issue 2...
The text was updated successfully, but these errors were encountered: