Answer the question
In order to leave comments, you need to log in
How to generate svg sprite (view data:image/svg+xml) in gulp for css (scss)?
Friends, hello everyone!
I use svg in css (scss) like this:
.class {
background: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22ht...') center no-repeat;
background-size: contain;
height: 30px;
width: 30px;
}
Answer the question
In order to leave comments, you need to log in
Yes, great approach. Especially for small icons. Partially, this https://codepen.io/alexcss/pen/aVLjLx
can help solve the issue.
There is a scss mixin that automatically decodes SVG code into a background image.
This method works everywhere. According to this article https://codepen.io/tigt/post/optimizing-svgs-in-da... not
all URL Decoders encode SVG appropriately.
And automatically substituting the source of svg files there, for example from a folder, can be configured via gulp.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question