# gulp-svgo

> Optimizing SVG vector graphics files with Gulp

Latest version **3.0.1** (published 2026-08-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-svgo
pnpm add gulp-svgo
yarn add gulp-svgo
bun add gulp-svgo
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2026-08-24 |
| First published | 2016-04-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22.18.0 |
| Dependencies | 1 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18 |
| Author | Cornelius Ukena |
| Maintainers | corneliusio |
| Keywords | gulp, gulpplugin, minify, optimize, svg, svgo |

## Links

- npm: https://www.npmjs.com/package/gulp-svgo
- Repository: https://github.com/corneliusio/gulp-svgo
- Homepage: https://github.com/corneliusio/gulp-svgo#readme
- Issues: https://github.com/corneliusio/gulp-svgo/issues
- npm.io page: https://npm.io/package/gulp-svgo

## Dependencies (1)

- [svgo](https://npm.io/package/svgo.md) ^4.1.0

## Recent versions

- 3.0.1 (latest) — 2026-08-24
- 3.0.0 — 2026-08-24
- 2.3.0 — 2026-08-24
- 2.2.1 — 2020-04-10
- 2.2.0 — 2020-04-10
- 2.1.1 — 2019-03-26
- 2.1.0 — 2018-12-19
- 2.0.0 — 2018-12-15
- 1.5.4 — 2018-05-03
- 1.5.3 — 2018-04-27
- 1.5.2 — 2018-04-26
- 1.5.1 — 2018-04-26
- 1.5.0 — 2018-04-19
- 1.4.0 — 2018-02-28
- 1.3.1 — 2018-02-05
- … 11 more at https://npm.io/package/gulp-svgo/versions

## README

# gulp-svgo

[![NPM Version](https://img.shields.io/npm/v/gulp-svgo.svg?style=flat-square)](https://npmjs.com/package/gulp-svgo) [![NPM Downloads](https://img.shields.io/npm/dm/gulp-svgo.svg?style=flat-square&colorB=007ec6)](https://npmjs.com/package/gulp-svgo) [![Build Status](https://img.shields.io/github/actions/workflow/status/corneliusio/gulp-svgo/test.yml?branch=master&style=flat-square)](https://github.com/corneliusio/gulp-svgo/actions/workflows/test.yml)

Optimizing SVG vector graphics files with Gulp

A thin wrapper around [svgo](https://www.npmjs.com/package/svgo) for Gulp. Will pass through any non-svg files unaltered so you can use it in conjunction with other image optimization tools if you don't want a separate task for different file formats.

Requires Node.js 22.18 or newer (gulp-svgo >=3.0.0). For older Node.js versions, use gulp-svgo 2.x.

## Install

```
$ pnpm add -D gulp-svgo
```

## Usage

<!-- prettier-ignore -->
```js
import gulp from 'gulp'
import svgo from 'gulp-svgo'

export const images = () =>
    gulp.src('src/img/*')
        .pipe(svgo())
        .pipe(gulp.dest('dest/img'))
```

CommonJS gulpfiles work too — `const svgo = require('gulp-svgo')`.

## Options

Options are passed directly to [svgo](https://www.npmjs.com/package/svgo) `optimize()` and use the svgo v4 [configuration format](https://svgo.dev/docs/preset-default/):

```js
svgo({
    plugins: [
        {
            name: 'preset-default',
            params: {
                overrides: {
                    removeDoctype: false,
                },
            },
        },
    ],
})
```

## Behavior

- Null files (e.g. from `gulp.src(..., { read: false })`), pathless files, empty files, and non-svg files pass through untouched.
- Stream-backed file contents are not supported and emit an error.
- SVGs that fail to parse emit a stream error (with the original error as `cause`) instead of being silently dropped, so broken files fail your build.
- svgo is an optimizer, not a sanitizer. Do not treat optimized SVGs from untrusted sources as safe browser content.

## Migrating from v2

- Node.js 22.18+ is required.
- Options now use the svgo v2+ format shown above. The v1 shorthand (`plugins: [{ removeDoctype: false }]`) no longer works, and `cleanupIDs` is now `cleanupIds`.
- Malformed SVGs now fail the stream instead of being silently dropped (v2.2.1 and earlier) or logged and passed through (v2.3.0). Handle the error in your task if you want to continue past bad files.
- Optimized output differs from svgo 1.x (e.g. attributes are sorted, `viewBox` is preserved by default).

---
_Source: https://npm.io/package/gulp-svgo · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
