Hello, first of all thank you for this great tool! Second, and kinda newbie question, but how does one create a config file?
I created config.yml file:
plugins:
- cleanupNumericValues
floatPrecision: 1
and put it beside my .svg images, and run in terminal:
svgo --pretty -i jez.svg -o jez.min.svg --config=config.yml
and can't get decimal rounding to 1 point. Am I missing something obvious, or completely missed the point? Can someone point me in the right direction?
I'd also be interested in understanding how to set the floatPrecision. Thanks!
Update: There should be a colon after cleanupNumericValues.
Take a look on .svgo.yml. To set float precision you need to change from
- cleanupNumericValues
to
- cleanupNumericValues:
floatPrecision: 1
Note, that there is several plugins that have this option.
@GreLI Thanks so much for the quick response! After taking a look at the docs, things made much more sense and I was able to get everything working correctly.
To your point that several plugins use this option, my issue was actually with the convertPathData plugin, so good call on keeping an eye out for that.
No problem! There is an issue about cli-option #99, but no progress yet.
Thanks @GreLI, you saved my time. List of all related plugins in my config here:
{
plugins: [
{
cleanupNumericValues: {
floatPrecision: 2
}
},
{
convertPathData: {
floatPrecision: 2
}
},
{
transformsWithOnePath: {
floatPrecision: 2
}
},
{
convertTransform: {
floatPrecision: 2
}
},
{
cleanupListOfValues: {
floatPrecision: 2
}
}
]
}
FYI, there is --precision option that does the same added in v.0.5.1. The only exceptions are transforms鈥攂ecause multiplication requires more presision.
Thanks again! Somehow I missed it but also I have trouble with it :(
I try to use global precision param as 2 with gulp-svgmin and gulp-svgo but both uses with default precision 3 in process. My config after your advice is here:
{
precision: 2
}
What am I doing wrong?
Actually default config file has no global precision param, that's interesting.
It's actually floatPrecision in config like plugins parameter.
It's alive! Thank you very much for your time :)
Can you please add this to the readme? Took me a while to find it 馃悓
Most helpful comment
Can you please add this to the readme? Took me a while to find it 馃悓