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 the name of the svg being processed as a param into a plugin #623

Closed
harrisjose opened this issue Nov 15, 2016 · 5 comments
Closed

Comments

@harrisjose
Copy link

Is there any way to pass in the filename of the current svg into a plugin ?

The reason why i need this is because a lot of our svgs are exported from illustrator and have style tags with class names like .st0 {} .st1 {}. This causes a issues when we use a lot of svgs in a single page, as the styles get overriden.

An easy way to solve this would be to replace a class like .st0 to .svgName0..which is why i need the file name. I'd also appreciate other ideas on solving this.

@bomberstudios
Copy link

+1. I recently added an auto prefixing feature for defs to https://github.com/BohemianCoding/svgo-compressor, based on the SVG filename, and was considering sending a pull request to make it "native" to SVGO.

@harrisjose
Copy link
Author

Even though I mostly don't have this issue these days ( we just started using attributes or inline styles when exporting svgs ), I'd still love to see this being natively supported in svgo.

@strarsis
Copy link
Contributor

strarsis commented Apr 5, 2017

@bomberstudios: Recent svgo supports this now (#700).

@bomberstudios
Copy link

👏👏👏👏

@harrisjose
Copy link
Author

Closing this since prefixIds plugin by @strarsis takes care of what I was originally trying to achieve.

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

3 participants