Back to Svgo

convertPathData

docs/04-plugins/convertPathData.mdx

4.0.1969 B
Original Source

Optimize path commands found in <path>, <glyph>, and <missing-glyph> elements. Path commands are the syntax used in the d attribute, each character represents an instruction to draw paths.

:::info

You can get more context on path commands on MDN Web Docs.

:::

This plugin uses multiple techniques to either reduce the number of instructions or reduce the attribute length:

  • Convert between relative or absolute coordinates, whichever is shortest.
  • Convert between commands. For example, a Bézier curve that behaves like a straight line might as well use a line instruction.
  • Remove redundant commands. For example, a command that moves to the current position can be removed.
  • Trim redundant delimiters and leading zeros.
  • Round numeric values using conventional rounding rules.

You can read more about the plugins capabilities by going through the individual parameters.