D
D
Dmitry2021-03-18 12:42:00
css
Dmitry, 2021-03-18 12:42:00

How to output svg sprite to background image?

Good afternoon. When laying out, I use the Gulp assembler and assemble the svg sprite using gulp-svgstore. If you insert svg from a sprite in this way

<svg class="article__icon">
  <use xlink:href="images/sprite.svg#icon-glasses"></use>
</svg>

Everything is working. But here to insert an image from a sprite as a background - nothing works. I came across this solution to the problem: What are the ways to connect an svg sprite to the background? but my sprite is going through
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><symbol id="icon-arrow--green" viewBox="0 0 14 10">
<path d="M13 5H1M13 5L9.5 1.5M13 5L9.5 8.5" stroke="#25AF7C" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/>
</symbol>...

How to replace symbol with view for above plugin? Or is there another solution?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question