
pug is automatically appended to the file name.) Then, define one or more blocks to override the parent block content.īelow, notice that the foot block is not redefined, so it will use the parent’s default and output “some footer content”. To extend this layout, create a new file and use the extends directive with a path to the parent template. - layout.pug html head title My Site - # block scripts script ( src = '/jquery.js' ) body block content block foot #footer p some footer content The example below defines block scripts, block content, and block foot. Providing default content is purely optional, though.

Pug blocks can provide default content, if appropriate. In a template, a block is simply a “block” of Pug that a child template may replace. Template inheritance works via the block and extends keywords. Priorly, I had no trouble generating tables using hard coded options.attribute kinda values that I was able to pass to pug file.Pug supports template inheritance. but I don't even use express or anything, I am simply trying to generate HTML using my template. I have seen numerous examples on the internet which uses code like app.render() etc. The problem I have is to pass my "tasks" object from my typescript/javascript file to the pug file. What I am trying to achieve is actually quite simple, using "each", dynamically adding table rows.

My use case is that I use pug to generate e-mail friendly html which cannot have any scripts inside (for whatever reason). I do have an issue with the library which doesn't necessarily indicate a bug. Name Surname Organization Action Mmm Ddd Hhh add Aaa Ooo 333 add Aaa Bbb Ddd add Aaa Ddd Vvv update Caa Ccc Ooo update Sss Ooo Aaa update Aaa Rrr Mmm remove Sss Ccc Iii remove Bbb Ooo Aaa remove Actual HTML
