Answer the question
In order to leave comments, you need to log in
How to pass different data for cards of the same type in pug mixin?
Just starting to touch pug and need help.
I made a card template in a pug file, which I want to transfer using a mixin to another file with different data (additional class, picture and text data):
mixin masonry-card(ClassName, product)
.masonry-card(class= ClassName)
a.masonry-card__img-wrapper(href="#")
img.masonry-card__img(src="img/" + product.img)
.masonry-card__info
a.masonry-card__title(href="#")= product.title
a.masonry-card__author(href="#")= product.author
span.masonry-card__type Картина, 80x60 см.
.masonry-card__footer
.masonry-card__price= product.price
<span class="masonry-card__price-rub">7</span>
.masonry-card__old-price= product.oldPrice
include ../masonry-card/masonry-card
+masonry-card('new-works__grid-item', {img: 'masonry-card-1.jpg', title: 'abc', author: 'author', price: '12348', oldPrice: '23456'})
Answer the question
In order to leave comments, you need to log in
Not sure if your nesting level is correct, try placing the element at the same level as the include:
include ../masonry-card/masonry-card
+masonry-card('new-works__grid-item', {img: 'masonry-card-1.jpg', title: 'abc', author: 'author', price: '12348', oldPrice: '23456'})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question