svgo
svgo copied to clipboard
Variable floatPrecision
I would like the option to use a different floatPrecision
to round stroke-width
, stroke-opacity
to 2dp and paths
to 0dp
eg.
<path fill="none" stroke="#F9ED69" stroke-miterlimit="10" stroke-opacity=".74698" stroke-width=".33333" d="m110.5 166.7 16.8 18.4 24.9 2.8 13.5 21 24.7-4 24.2-6.2 24.4-5.4 24.8...
would become
<path fill="none" stroke="#F9ED69" stroke-miterlimit="10" stroke-opacity=".75" stroke-width=".33" d="m111 167 17 18 25 3 14 21 25-4 24-6 24-5 25...
Maybe the floatPrecision
option can be extended? Something like...
const result = optimize(data, {
multipass: true,
floatPrecision: {
default: 3,
path: 0,
strokeWidth: 2,
strokeOpacity: 4
}
});
relevant: https://github.com/svg/svgo/issues/1828
https://github.com/svg/svgo/pull/1843
If that closes this you should add "closes #1838" to the PR description