Support for SVG in CSS files
See original GitHub issueThis is a great loader, but it shouldn’t break when the svg file is loaded by an scss file. As in this example:
.foo {
background-image: url(images/icon.svg);
}
Currently, these images are loaded as [object Object]
strings.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:19
- Comments:8 (1 by maintainers)
Top Results From Across the Web
SVG Properties and CSS
SVG has its own set of elements, attributes and properties to the extent that inline SVG code can get long and complex. By...
Read more >SVG and CSS - SVG: Scalable Vector Graphics | MDN
This page illustrates the application of CSS to the specialized language for creating graphics: SVG.
Read more >"svg" | Can I use... Support tables for HTML5, CSS3, etc
3 IE9-11 & Edge don't properly scale SVG files. Adding height, width, viewBox, and CSS rules seems to be the best workaround.
Read more >How to style SVG with external CSS? - Stack Overflow
If you want to keep your SVG in files, the CSS needs to be defined inside of the SVG file. You can do...
Read more >How to Use SVG Images in CSS and HTML – A Tutorial for ...
SVG stands for Scalable Vector Graphics. It is a unique type of image format for vector-based graphics written in Extensible Markup Language ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is a very clean way to achieve it. Just use the
issuer
field, which should be equal to file that initiated the import.If you have any other loaders (like file-loader etc.) matching
/\.svg$/
pattern, you may need to apply that rule for them as well, i.e.issuer: /\.s?css$/,
Could also be fixed by separating SVG files used in JS and CSS into two different folders, and adjust the webpack config to only use react-svg-loader on SVG files in one of the folders…