vbenjs / vite-plugin-svg-icons

Vite Plugin for fast creating SVG sprites.
MIT License
801 stars 109 forks source link

Optionally replace stroke color #68

Open digitalacorn opened 2 years ago

digitalacorn commented 2 years ago

Expose an option to enable or disable the replacement of the stroke colors within the SVG content.

Default behaviour remains the same

peterdzl commented 2 years ago

@anncwb Hi - Please could you run this trivial update through the workflow for a patch update

nelsonjd commented 2 years ago

@anncwb I need this too. Can you take a look at this pr? Thanks.

tangxiangmin commented 1 year ago

+1

seahindeniz commented 1 year ago

I believe this is not in the scope of this plugin. The expected logic should be handled by an SVGO plugin

peterdzl commented 1 year ago

I believe this is not in the scope of this plugin. The expected logic should be handled by an SVGO plugin

Thanks for the reply - it seems colours are replaced by this module /after/ the SVGO stage. How do you propose this is solved by the SVGO options?

digitalacorn commented 1 year ago

I have published a forked version which supports disabling the replacement of the stroke colour. https://www.npmjs.com/package/@digitalacorn/vite-plugin-svg-icons

alexgilbertDG commented 1 year ago

This should be merge

ywenhao commented 1 year ago

This should be merge

bineagu commented 10 months ago

This is annoying, been playing with svgo options and it drove me mad, only to find out the issue was in this plugin all along.

mikezotovdev commented 6 months ago

Hey @anncwb, could you please take a moment to review that MR and merge it? If there are any additional changes or adjustments needed, I'm more than willing to collaborate further to ensure its seamless integration into the project. I hope @digitalacorn also could help.

Here is a little example of inconsistency, that the default behavior of the plugin produces: in the USA SVG flag, it makes white stripes black. And it's not possible to fix it, rather than passing color: #fff, which is not something that I want to do, since the fill color shouldn't be always #fff - there are more flags with not only white strokes. It also affects 17 more flags from one popular library with SVG country flags.

Black USA flag (the stroke was replaced with currentColor):

image

Proof that not only white color is used as a stroke: telegram-cloud-photo-size-2-5449688246331233981-y

Is there any chance you can merge the changes and deploy a new version of your plugin?