Answer the question
In order to leave comments, you need to log in
How to make jade mixin for svg?
Good day!
I made this mixin:
mixin use(name)
svg.name(role="img")
use(xlink:href="#{svg}#name")
ul
li
+use(pencil)
<svg role="img" class="pencil">
<use xlink:href="images/icons.svg#pencil"></use>
</svg>
<svg role="img" class="name">
<use xlink:href="images/icons.svg#name"></use>
</svg>
Answer the question
In order to leave comments, you need to log in
Solution of the problem:
mixin use(name)
svg(class="#{name}" role="img")
use(id="#{name}" xlink:href="#{svg}##{name}")
Enclose the name in quotation marks
As a result
- var svg = "images/icons.svg"
mixin use(name)
svg.name(role="img")
use(xlink:href="#{svg}##{name}")
+use("pencil")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question