-
-
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
Remove fill and stroke unless "none" #440
Comments
|
Sorry, I don't understand your first statement.
It's likely that |
Ah. I'll try that. Let me reiterate my first statement: When using these svg's inline an styling with CSS, its nice to be able to set the stroke and fill colors. Thus, I want to remove the stroke and fill colors. However I want to preserve all styles where fill is set to none -- that is, I want to preserve hallow regions. Stripping all fill attributes will cause icons to look wrong. |
Well, |
ok. I see. SVG's are kind of a pain.... :/ |
This is actually a valid use case. I've just come across it myself. It'd be nice to strip out all color and fill refs if they aren't set to "none". We need to keep "none" as it preserves some important styling. SVGO is an optimizer, and optimizing for the web should be a valid use case. Being able to set the colour of SVGs using CSS is a huge plus, and this can't be done if there's stray fills or colours in the file. |
I agree that there is a valid use case for this. Lets say you have an icon library with a consistent container size, such as This normally wouldn't be an issue so long as you can leave the container path to While I know I can prevent A proposed solution would be something along the lines of |
is there a way today to remove all |
@ailet37 I still haven't been able to figure out a solution to removing all It's not great and I wish the owner would reconsider adding this functionality since it has numerous valid implementations. |
@GreLI @ccorcos @KingScooty @ekfuhrmann @ailet37 I've opened pull request #977 that addresses this issue. Proposed solution:
|
This has now been resolved and merged via #977 |
Should work in SVGO v1.2.0. |
when I'm styling my SVG's with CSS its nice to strip all the inline colors so I can style them myself. This challenging when colors are set with inline styles. So I strip them out:
But then there are circles that are filled in when they shouldnt be. So it would be aweosme if you could strip all the stroke and fill attributes so long are they're not none. Unless you've found a better way of dealing with this...
The text was updated successfully, but these errors were encountered: