Skip to content
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

Inheritance and variable passing between parent to child is not working #3407

Open
satyendera opened this issue Mar 21, 2023 · 1 comment
Open

Comments

@satyendera
Copy link

satyendera commented Mar 21, 2023

Here is a.pug

  • var pets = ['cat', 'dog']
    each petName in pets
    include b.pug

Screenshot 2023-03-21 at 1 38 08 pm

here is test.pug
p= petName
Screenshot 2023-03-21 at 1 38 16 pm

here is output over browser
empty 2 P tags

<p></p>
<p></p>

Screenshot 2023-03-21 at 1 38 52 pm

and if I use variable using #{variablename}
it prints

Please help me don't know what's wrong

Pug Version: 3.0.2

Node Version: 14.21.3

using webpack html-webpack-plugin to rednder pug

Please let me know if you need additional information

@svallory
Copy link

Includes can't be used dynamically in any way. You need to wrap the code in a mixing, include the file before the each and call the mixin inside the each statement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants