-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing ids of gradients in defs #88
Comments
Hey @amykapernick. IIRC that ID re-generation in SVGInjector was done so that multiple instances of the same SVG could be injected safely on the page. Think I get what your particular issue might be, but can you please try isolating & recreating it so I can get a better handle on what's going on? You could try forking the basic CodeSandbox example? |
@tanem the issue is that it keeps changing the number at the end of the id depending on the page it's on (https://5b2bc282b13fb1249c8fbb0b--aimhigher-dev.netlify.com/ the svg is in the header under HeroBack) because the appending number is a global variable. I want the id to remain whatever I set it, because I want to be able to apply the background in my CSS, not have it inline on the SVG |
Thanks for the example. Looks like this issue huh iconic/SVGInjector#29. I'll post back once I've had a chance to think about things a bit more 🤔 |
@amykapernick just set up #89 which will allow us to turn off the renumeration of all IRI addressable elements. Think this should address your use-case? I'm planning on shipping this tomorrow sometime anyway. |
Just published |
Closing as no response, but feel free to ping me if anything crops up. |
Need solution for issue : iconic/SVGInjector#29 (comment) |
Have you tried setting A permanent solution is a bit more involved, have had it on my backlog for a while 😅 |
By Adding renumerateIRIElements='false'; SVG image is calling by source url, not by injector. Below is code how I have applied this property. Also let me know if i am applying it on wrong place. var injectElement = function (el, evalScripts, pngFallback, callback) {
|
Some q's/suggestions:
|
I've been having issues where it's changing the ID of my gradient and therefore breaking the reference to the style, and because the appending number is a global variable, it changes each time I load a page.
It's possible to stop incrementing the ids by removing
linearGradient: ['fill', 'stroke'],
fromsrc/inject-element.js
in the svg-injector module, but can you set it so that each of these items in theiriElementsAndProperties
object can be turned on and off in a config? If we're writing our code properly, we shouldn't get duplicate ids anywayThe text was updated successfully, but these errors were encountered: