LinuxCommandLibrary

svgo

Node.js-based SVG optimization tool

TLDR

Optimize SVG

$ svgo [input.svg] -o [output.svg]
copy
Optimize in place
$ svgo [file.svg]
copy
Optimize directory
$ svgo -f [./icons] -o [./optimized]
copy
Show file info
$ svgo [file.svg] --show-plugins
copy
Use config file
$ svgo --config [svgo.config.js] [file.svg]
copy
Disable plugin
$ svgo --disable=[removeViewBox] [file.svg]
copy
Enable plugin
$ svgo --enable=[removeDimensions] [file.svg]
copy
Pretty print output
$ svgo --pretty [file.svg]
copy

SYNOPSIS

svgo [-o output] [-f folder] [--config file] [options] files

DESCRIPTION

svgo (SVG Optimizer) is a Node.js-based tool for optimizing SVG files through a plugin architecture. Each plugin handles a specific optimization such as removing metadata, simplifying path data, merging redundant elements, cleaning up attributes, or removing empty containers.
Plugins can be individually enabled or disabled through a configuration file or command-line flags, allowing fine-grained control over which optimizations are applied. The multipass option runs optimizations repeatedly until no further improvements are found. Folder mode batch-processes entire directories of SVG files.
SVGO is widely used in front-end build pipelines and icon library workflows to minimize SVG file sizes before deployment. Pretty-print mode reformats output for readability when human-editable SVGs are needed.

PARAMETERS

-o, --output FILE

Output file.
-f, --folder DIR
Input folder.
--config FILE
Config file.
--disable PLUGIN
Disable plugin.
--enable PLUGIN
Enable plugin.
--pretty
Pretty print.
--multipass
Multiple passes.
-q, --quiet
Quiet output.

CONFIGURATION

svgo.config.js

Project configuration file defining enabled/disabled plugins and their options.

CAVEATS

Some optimizations may affect rendering. Test output visually. Complex SVGs need care.

HISTORY

SVGO (SVG Optimizer) is a Node.js tool for SVG optimization. It's widely used in build processes and icon libraries.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community