-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
fix(svgo): enable prefixIds by default #8191
Conversation
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
⚡️ Lighthouse report for the deploy preview of this PR
|
Hi
Sorry but enabling prefixIds by default is a breaking change that could break the existing CSS selectors of multiple sites. Even if we merge this in a major release, this is likely to annoy many users when upgrading, while it has only be asked by you so far. Instead of enabling such a thing by default, I'm more likely to accept a PR that allows you to more easily customize the SVGO config: this way you can enable prefixIds yourself and others don't have to change their code. |
Hi @slorber, As svgo changes the ID of each svg file based on usage order, it means that the selector is based on an ephemeral value, which is not the best choise IMO. What I'm trying to introduce here is a fix for a bug that should not require additional settings: when different svgs files define different gradients, the gradients ID should not overlap as is doing now, mixing color definitions. Maybe in a major, but IMO this should not be fixed with an external configuration. |
If this is a reasonable default to have in SVGO, then you'd rather convince the SVGO team to enable this by default. If you can, then we'll have this after upgrading and releasing the next SVGO major version. They probably don't want to enable this by default for the same reason as me. Some users add hardcoded ids to svgs on purpose, and they don't want those ids to change magically by default, this would be a very confusing default behavior |
But the hard-coded ids are anyway processed by svgo, which substitute them with "a", "b"... The reason why svgo avoid to enable it by default is that it creates much longer ID than necessary. So, they avoid it until someome needs it. Btw, fine. |
Hello guys,
with this PR I would like to activate by default the
prefixIds
plugin ofsvgo
.It is useful to avoid any kind of id collision that could happen when are defined different
linearGradient
for multiple svgs in the same page.