cc young
cc young

Reputation: 20213

in jade, how do you used the same block name in more than one level?

have a working base file and extension, page.jade and layout.jade

wish to put an extension between them that will modify page's block before layout gets it. possible to retain the block names and do this? otherwise, much code needs changing.

currently, in layout.jade:

body
  p Greetings
  block content
  p Goodbye!

and in page.jade

extends layout
block content
  p Nice to meet you

results in:

Greetings
Nice to meet you
Goodbye!

wish to insert an extension middle.jade between layout.jade and page.jade. page.jade would extend middle, and middle would extend layout.

for example, middle.jade

extends layout
block content
  p Good Morning
  block content

with target result:

Greetings
Good Morning
Nice to meet you
Goodbye

when I try this, the middle.jade block is not picked up at all.

am I being stupid and missing something obvious? or is this even possible?

Upvotes: 1

Views: 246

Answers (1)

Ven
Ven

Reputation: 19040

Either nest it differently

block page_content
  block content

or use block append / block prepend

block append page_content
  blabla

Upvotes: 1

Related Questions