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

Remove default values like stroke-dasharray="none" stroke-opacity="1" #1973

Open
atom3001 opened this issue Mar 31, 2024 · 6 comments
Open

Comments

@atom3001
Copy link

atom3001 commented Mar 31, 2024

Hi, I'm using SVGOMG, which is great, but can't remove wadding like default path values. Eg
stroke-dasharray="none" stroke-opacity="1"

@KTibow
Copy link
Contributor

KTibow commented Mar 31, 2024

Tip: SVGOMG hasn't been updated for a while, and won't be updated until #1943 is merged. https://omfg.svg.beauty/ is slightly more up to date, but it's best to directly use the library/CLI if you can.

Commentary on the issue: This is already done to some degree, but I wouldn't be surprised if it doesn't work in all cases. Want to share an example SVG where it should remove it but doesn't?

@atom3001
Copy link
Author

atom3001 commented Apr 1, 2024

Thanks for the quick response @KTibow. Am running omfg via CLI now. Which does remove raster images properly, which is nice. I suppose I need to develop a plugin to add this feature but am pretty green so will be a struggle. Will paste an image with stuff I'd like to clean out. EG Defaults like:
stroke-dasharray="none" stroke-opacity="1"

Styles to attributes gets rid of the above defaults on the last path but misses the initial two. Any help greatly appreciated

RR_v1_trim_1
RR_v1_trim_1_svgofm_1

@KTibow
Copy link
Contributor

KTibow commented Apr 1, 2024

It seems the optimization is disabled when the path is linked in a use. I haven't found where this optimization is applied yet so I don't have much to add.

@atom3001
Copy link
Author

atom3001 commented Apr 1, 2024

Yes, if I drop the use elements the path styles get cleaned properly. good spot, thanks. So I could cleanup before cloning. Shame to have a fragmented workflow. But writing plug-ins to do a second cleaning pass is beyond me for now. Thanks again for looking

@KTibow
Copy link
Contributor

KTibow commented Apr 3, 2024

I checked and the relevant plugin is removeUnknownsAndDefaults, which actually doesn't clean defaults on attributes with an id

@atom3001
Copy link
Author

atom3001 commented Apr 8, 2024

Interesting, thanks for digging deeper @KTibow. Still leaves me in the same boat. Perhaps it would be possible to disable that id limitation?

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

No branches or pull requests

2 participants