Optimize SVG content passed from another command, and save the result to a file

svgo

  • SVG Optimizer: a Node.js-based tool for optimizing Scalable Vector Graphics files.
    It applies a series of transformation rules (plugins), which can be toggled individually.
    More information: <https://github.com/svg/svgo>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

{{cat test.svg}} | svgo -i - -o {{test.min.svg}}

click the source code to copy install svgo on any operating system with command-not-found.com