-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Disable cleanupIds
by default
#1714
Comments
SVGO by default optimizes svg image to not break when used as is. Any optimization can break embedded svg. Scripts or styles can access svg structure or rely on specific values. It's up to specific usage what to disable. Also collisions are possible with existing ids. You can add prefixIds plugin if not embed same svgs twice. |
Yes that's true, I think my problem with this is if I used SVGO and do nothing but add 2 svgs to a webpage, they will be broken by default. This seems like a bad dev experience. True collisions can happen by default as well, but at least in that case it's easier to debug/fix. It's difficult to debug the problem in upstream projects because they're sometimes separated by many layers of dependencies. I guess the real solution is minification that tracks the global context to prevent collisions, but I imagine that's difficult/impossible in webpack otherwise you would have done it. Anyway, it's up to you, the problem is easily solved with a config. Also, please don't take my criticism as a lack of appreciation, great work here. |
I'll close this in favor of #1746 which dives into more detail. I'm not sure what's the best action to take here yet, especially as this is causing issues downstream, like with Docusaurus. 🤔 I think Something that could alleviate the issue is to introduce a setting like I will investigate if there's anything SVGO can do to make it easier to manage. An immediate solution is probably to use |
@SethFalco Just wondering, is there a reason you closed this issue? Asking because I noticed in my tests that SVGO no longer seemed to be minifying IDs - maybe because you ended up disabling |
I explain why in my comment above!
This issue should not be resolved yet, there's just another issue that covers the same bug, but is more explicit, that's all. PS: I am working on some documentation which includes the workarounds for this issue: |
I see, I suppose I was expecting that there would be some changes that resulted in
I've come across I have also come across that documentation site, great work and I can't wait to see it and the positive impact it'll have on this tool when it's publicly released. |
Hmm, immediately I can't tell. 🤔 If there's a problem with sharing the file publicly, I'd be happy for you to email it to me instead. You can find my email on my GitHub profile. |
Sent, you may need to check your spam. |
Oh, I already received and responded to your email. ^-^' If not, would you mind adding me as a trusted/safe sender and I can try again perhaps? Google seems to be fine, but everyone else is mad at me for having |
Yeah, it was me that needed to check my spam after all. You'd think a response from someone I emailed first wouldn't be marked as spam, but that's Outlook for you. Now replied. |
Is your feature request related to a problem? Please describe.
The
cleanupIds
option does not check for id uniqueness globally. This causes a page with multiple SVGs to have id collisions. This is causing problems in downstream projects, particularly docusaurus.Describe the solution you'd like
cleanupIds
is disabled by default.The text was updated successfully, but these errors were encountered: