V
V
Vasily2016-07-13 08:52:04
Pug
Vasily, 2016-07-13 08:52:04

How to make a jade header template so that the header class changes on different pages?

in header.jade ->
.header.header_ind
There is a div that has a class (.header.header_ind)
in index.jade ->
include /header.jade
in news.jade ->
include
/header.jade file news.jade included div , but with class (.header)
Tried to do this:
in header.jade
.header(class="#{head == 1 ? 'header_ind' : ' '}")
in files :
in index. jade
-var head = 1
in news.jade
-var head = 0
BUT the compiler throws an Error :(
How to solve this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2016-07-13
@lunpully

I solve a similar problem using mixins instead of includes

+body
    .stick
        +header
        .middle

And in the file with mixins, which I connect with an include, I specify:
mixin header(active)
   header&attributes(attributes).header
    ...

pay attention to header

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question