Answer the question
In order to leave comments, you need to log in
Jade. How to pass a variable from one template to another one, included?
In the page template, I have the .container block connected 3 times. But the first time with .container_one modifier, then .container_two and finally .container_three. So in the end it looks like this:
<div class="container container_one">
<div class="container container_two">
<div class="container container_three">
{% include 'template.html' with modificator %}
<div class="container {{ modificator }}">
Answer the question
In order to leave comments, you need to log in
Jade does not have such a beautiful construction, but it does have mixins .
// container.jade
mixin container(modifier)
.container(class=modifier)
// index.jade
include ./container // надо явно заинклюдить файл с миксином
+container('container-one')
+container('container-two')
+container('container-three')
// container.jade
mixin container()
.container&attributes // http://jade-lang.com/reference/attributes/
// index.jade
include ./container
+container().container-one
+container().container-two
+container().container-three
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question