A
A
Andrey Prozorov2017-03-31 14:58:05
Pug
Andrey Prozorov, 2017-03-31 14:58:05

How to layout a multi-page static site using JADE?

I do so. I create jade + sass + js block. One block = BEM block.
This is a really cool scheme. There is only one drawback. Different pages have different content. I hide the content in BEM block for example content which is hidden in a block for example middle (this is for example if there is a sidebar)
Then a very ugly topic begins. Option 1 page.jade
+ middle(".......long content escaping any characters......") middle.jade +content(content) content.jade #{content} The disadvantage of this approach is that you have to escape characters, remove hyphens, and so on Option 2 page.jade +middle("page_alias") middle.jade +content(page_alias)
content.jade
if page_alias == "a"
......content output.....
This is generally a rather flawed method. in the content.jade file, you get a dozen branches with if .... else if ...
How to be that one?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2017-03-31
@i_d_1

Put those blocks that are repeated into mixins, for example, a header, footer and the like, write the content itself directly in the page file, you can look at an example here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question