J
J
Jason_Statham2017-10-25 18:57:15
Pug
Jason_Statham, 2017-10-25 18:57:15

Why in Jade/pug, when a mixin is called more than once, its contents are duplicated in the following?

Good day! There was a problem with mixins in Jade/pug. I created this mixin

mixin containerFull(number)
    div(class="container-full block-#{number}")
        .container
            block content

(if anything, mixins are moved to a separate file). Further. I called him twice in the code so that he created two blocks for me with the same markup, but different content.
.ChinaCampus
        +containerFull(1)
            block content
                .row
                    +image(1,'ChinaCampus/head.png')
                    +image(2,'ChinaCampus/head.png')
        +containerFull(2)
             block content
                .row
                    +image(1,'ChinaCampus/logo.png')
                    +image(2,'ChinaCampus/triple.png')

And it turns out that it completely copies the content from the first mixin. I’ve been googling for half a day already, I can’t understand what the point is. I tried to use include instead of mixins, but the result is the same. Either the skis don't roll, or I *@/... Chew please

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Khokhlov, 2017-10-25
@Jason_Statham

https://pugjs.org/language/mixins.html#mixin-blocks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question