Answer the question
In order to leave comments, you need to log in
How to insert an argument into an attribute value in a pug mixin?
Here is a mixin that doesn't compile. You just need to insert the src of the image in style.
I tried without brackets and without a lattice - it's useless ... How is this done correctly?
mixin team(img_src)
span.team-card__photo(style="background-image: url("=#{img_src}");")
Answer the question
In order to leave comments, you need to log in
mixin team(img_src)
span.team-card__photo(style=`background-image: url(${img_src})`)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question