Reputation: 476
I'm trying to show a svg icon on html page with pug syntax, but doesn't work
This is the code
span.icon
svg(width="24px", height="24px")
use(xlink:href="../../../images/svg/glass.svg")
Upvotes: 0
Views: 12979
Reputation: 21836
The <use>
element cannot link to complete files, only to named fragments. There is a proposal to change this in the future, but for now, the root <svg>
element in file glass.svg
needs to have an id, lets say id="glassRoot"
. Then you can do
span.icon
svg(width="24px", height="24px")
use(xlink:href="../../../images/svg/glass.svg#glassRoot")
Upvotes: 6