Skip to content
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

Option to pass svg path into the prefixID plugin? #85

Closed
harrisjose opened this issue Jul 17, 2018 · 4 comments
Closed

Option to pass svg path into the prefixID plugin? #85

harrisjose opened this issue Jul 17, 2018 · 4 comments

Comments

@harrisjose
Copy link

The prefixIDs plugin in svgo accepts a path option passed into it via the options object in the optimize method. Examples here and here.

This is very useful in cases when a lot of the svgs in a project are exported from Adobe Illustrator and have classes like st0, st1. All the svgs have the same classes and the styles get messed up because of this.

Prefixing the svg classes with the relative paths is a nice way to ensure this does not happen. I guess the same could be acheived by prefixing a random value but the path option is nicer cause it's more readable while debugging.

@harrisjose
Copy link
Author

I'd be glad to help with a PR if you could just lay out what needs to be done both in this repo and in brocolli-svg-optimizer.

@voltidev
Copy link
Collaborator

voltidev commented Jul 17, 2018

It's related to the solved issue #68. It can be fixed with inlineStyles plugin like this. Anyway, I'll take a look at the path option when I have time.

@harrisjose
Copy link
Author

I was looking into the inlineStyles plugin as an alternative to this but was unsure about transitioning cause prefixIDs has been working very well for us.

Good to know someone else is using inlineStyles to to fix this. Thanks for the help :)

@voltidev
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants