assetopt

Guide

assetopt vs SVGO

assetopt and SVGO compared honestly — assetopt uses SVGO under the hood for SVG, and adds images, CSS, JS, smart routing, cache and a CI gate in one CLI. When to use each. MIT.

SVGO is the SVG optimizer — a plugin-based tool that strips comments, metadata and redundant attributes from SVG files. assetopt is a CLI that optimizes images, CSS, JS and SVG in one command.

The honest framing here is different from most comparisons: assetopt uses SVGO under the hood for its SVG step. So this isn’t “which SVG optimizer is better” — SVGO is. It’s “do you want SVGO on its own, or SVGO bundled with the rest of your asset pipeline, one config, one cache, one CI gate.”

TL;DR

assetopt SVGO
SVG engine SVGO (wrapped) SVGO (itself)
Asset types Images, CSS, JS, SVG SVG only
SVG plugin config surface Curated (multipass, minifyIds) Full (every SVGO plugin)
Runs images/CSS/JS too Yes No
Incremental cache Yes No
CI quality gate Yes (--min-savings) No
Config one .assetoptrc svgo.config.js
License MIT MIT

Where they fit

SVGO on its own

If your task is only SVG — an icon set, a sprite build, a design-system export — reach for SVGO directly. You get its complete plugin surface (svgo.config.js), including plugins assetopt doesn’t expose, and the tightest possible control over each transform:

npx svgo -f ./icons -o ./icons-optimized

That full configurability is exactly why assetopt delegates SVG to SVGO rather than reinventing it.

assetopt when SVG is one asset among several

Most projects don’t ship SVG in isolation — there are images, a stylesheet and a script alongside it. assetopt runs all four in a single pass, so SVG optimization comes for free with everything else and shares the same config, cache and reporting:

assetopt optimize ./public   # svg via SVGO, plus images, css, js

Its SVG defaults are safe: multipass: true (re-runs the pass until it converges) and minifyIds: false — because minifying id attributes can break SVGs referenced from external CSS (url(#icon)) or from sprites. You can flip either:

{ "svg": { "multipass": true, "minifyIds": true } }

What assetopt adds around SVGO

  • Incremental cache — an unchanged SVG is skipped on re-runs, alongside the rest of your assets.
  • CI quality gateassetopt optimize dist --min-savings 15 fails the build if total savings fall below a floor; assetopt audit flags oversized SVGs (default 50 KB) with a CI-usable exit code.
  • One config for everything.assetoptrc covers images, CSS, JS and SVG, found automatically by walking up from any subdirectory.

When to use which

  • SVG only, maximum control → SVGO directly. Full plugin config, nothing extra to learn.
  • SVG alongside images/CSS/JS, one tool, one cache, CI gate → assetopt (which runs SVGO for you).

They’re not really rivals — assetopt is a superset for mixed-asset projects that happens to use SVGO for the SVG part.

Trying assetopt

npm install -g @assetopt/cli
assetopt analyze ./public        # dry-run: see savings per file, writes nothing
assetopt optimize ./public

See the feature catalog for the full feature set, or the minify CSS & JS guide for the non-SVG side of the pipeline.

Get the CLI

$ npm install -g @assetopt/cli

Open source, MIT. See the docs orstar it on GitHub.