Svgo: Forcing absolute paths does not work

Created on 1 Jul 2019  路  6Comments  路  Source: svg/svgo

Command

svgo --disable=cleanupIDs,removeViewBox,convertStyleToAttrs,inlineStyles,mergePaths,moveElemsAttrsToGroup,moveGroupAttrsToElems,collapseGroups --enable=removeXMLNS --config='{"convertArcs":true,"forceAbsolutePath":true}' --input='input.svg' --output='output.svg'

Expected result

An SVG where all paths are absolute (e.g. no lowercase "m").

Actual result

No paths are absolute, like it is ignoring the forceAbsolutePath option.

Most helpful comment

Oh, that's quite recent. Your config is incorrect. You should pass an option to the plugin. Like

{"plugins": ["convertArcs",{"convertPathData": {"forceAbsolutePath": true}}]}

All 6 comments

There is no forceAbsolutePath option.

Oh, that's quite recent. Your config is incorrect. You should pass an option to the plugin. Like

{"plugins": ["convertArcs",{"convertPathData": {"forceAbsolutePath": true}}]}

Ah okay - thanks for this. Why doesn't convertArcs need that kind of config?

https://github.com/svg/svgo/blob/54f92ce2deccdbd3177b711b06aa0cf928039c4c/plugins/convertShapeToPath.js#L10

It does. Why do you think so?

I assumed that from your example (and my current code), but I noticed now that convertArcs didn't work either, haha. Now it works:

svgo --disable='cleanupIDs,removeViewBox,convertStyleToAttrs,inlineStyles,mergePaths' --enable='removeXMLNS' --config='{"plugins":[{"convertShapeToPath":{"convertArcs":true}},{"convertPathData":{"forceAbsolutePath":true}}]}' --input='input.svg' --output='output.svg'

Thanks a lot for your help and impressive response time. Maybe we should add a config example in the README.md?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bmcminn picture bmcminn  路  4Comments

wuz picture wuz  路  3Comments

crybat picture crybat  路  6Comments

gregberge picture gregberge  路  3Comments

Roman52 picture Roman52  路  5Comments