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
Add the preserveCurrentColor option to the removeAttrs plugin. #1000
Add the preserveCurrentColor option to the removeAttrs plugin. #1000
Conversation
|
||
@@@ | ||
|
||
{"attrs":"(fill|stroke)", "preserveCurrentColor": true} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume that the falsy case is covered simply by the fact that: removeAttrs.01.svg removeAttrs.02.svg both pass. Also, if this diff isn't clear, I simply copied one of those and added the fill="currentColor"
on line #11 above.
plugins/removeAttrs.js
Outdated
|
||
if(!(preserveCurrentColor && value === 'currentColor')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only potentially remove if we have NOT enabled this option AND the value is not currentColor. This is essentially same as what we did for svgstore: https://github.com/FWeinb/grunt-svgstore/pull/63/files#diff-239be4703ce423ab0e43053cdf58384bR176
… to add the stroke case.
SVGO v1.2.0 has been just released! |
Awesome @GreLI thanks! I can point back to SVGO proper 🙌 |
I had to restore branch until my company (and probably me) can properly update our package.json and what not (it's currently pointed to my fork which I obviously want to change but need to find a spare cycle) |
Hello, I just coded this up as a follow up for the issue I just logged #999 .. I've added some explanations in my diff to hopefully make it easy to review.
Also, nothing output when I ran:
npm run lint
andnpm test
returns307 passing (1s)
. Let me know if you like this and/or if there's any conventions I missed. Thanks for your time!