pugjs / pug

Pug – robust, elegant, feature rich template engine for Node.js
https://pugjs.org
21.7k stars 1.95k forks source link

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

Open satyendera opened 1 year ago

satyendera commented 1 year ago

Here is a.pug

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 commented 1 year ago

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