Closed
Description
The change in 0.8.0 to use url-loader
with limit 10k as a default loader breaks my svg sprite system.
The svg sprite system works like this: I put all my svgs in one folder, run svg-sprite to generate svg sprite (which is below 10k), then I have a custom Icon
component in which I import the svg sprite and load the apropriate icon using fragment identifiers
Icon Component:
import React, { PropTypes } from 'react'
import svgSprite from '../img/symbol/sprite.svg'
function Icon({ name }) {
return (
<svg>
<use xlinkHref={`${svgSprite}#${name}`} />
</svg>
)
}
Any idea how to fix this besides just adding more svgs to the sprite until it is bigger than 10k?
Metadata
Metadata
Assignees
Type
Projects
Relationships
Development
No branches or pull requests
Activity
gaearon commentedon Dec 4, 2016
Do fragments break with base64 URLs?
gaearon commentedon Dec 4, 2016
Or do you rather mean that it's unfortunate sprites get duplicated?
If this is the case I think we should disable inlining for SVG. After all the user could've put it directly into components if they wanted to inline it.
bogdansoare commentedon Dec 4, 2016
Fragments break with base64.
Also like you said it's unfortunate that we can't leverage caching and that we inline the whole sprite everywhere an icon is used.
Disabling inlining for SVG would solve the issue.
I'm going to research a bit svg sprite systems and see if there are other reasonable possibilities besides fragment identifiers.
gaearon commentedon Dec 5, 2016
Would you like to make a PR for a special case for SVG?
bogdansoare commentedon Dec 5, 2016
Sure, I'll be glad to make a PR
gaearon commentedon Dec 6, 2016
Fixed by #1180.
mzedeler commentedon Jun 13, 2018
What is required to make inlining of svg images below 10k work (again)?
tilman commentedon Jul 10, 2018
Is there a Option to re-activate base64 import for SVGs? I'm using SVGs in my CSS and i don't like the workflow of manually transforming it to base64 first.
This project was bootstrapped with [Create React App](https://github.…
3 remaining items