@shanzhai/minify-svg-step

A Shanzhai step which minifies a SVG file.

Usage no npm install needed!

<script type="module">
  import shanzhaiMinifySvgStep from 'https://cdn.skypack.dev/@shanzhai/minify-svg-step';
</script>

README

@shanzhai/minify-svg-step Continuous Integration License FOSSA Status Renovate enabled npm npm type definitions

A Shanzhai step which minifies a SVG file.

Usage

Within a trigger's event handler, return an instance of MinifySvgStep similar to the following:

new MinifySvgStep(
  `A description of the operation being performed`,
  new AnInputOfUnminifiedSvg(),
  new AnOutputOfMinifiedSvg()
);

Configuration Notes

The configuration used is highly aggressive. It should be reasonable for static SVGs.

  • Coordinates are rounded to the nearest pixels.
  • Colors are reduced from 24 to 12 bits.
  • Ids, classes, etc. are all removed.
  • Invisible elements are removed.
  • Grouping elements which do not alter appearance are flattened.

Dependencies

This package has the following runtime dependencies:

Name Version
svgo 2.5.0

Peer Dependencies

This package has no runtime peer dependencies (it does not expect any other packages to be installed alongside itself).

License

FOSSA Status