# rollup-plugin-svgo

> Import & clean svg files and export their content as strings

Latest version **2.0.0** (published 2022-06-03) · WTFPL license · 0 weekly downloads

## Install

```sh
npm install rollup-plugin-svgo
pnpm add rollup-plugin-svgo
yarn add rollup-plugin-svgo
bun add rollup-plugin-svgo
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2022-06-03 |
| First published | 2018-08-16 |
| Weekly downloads | 0 |
| License | WTFPL |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 (+4 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 23 |
| Author | Rasmus Porsager |
| Maintainers | porsager |
| Keywords | rollup-plugin, svg, svgo |

## Links

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

## Dependencies (1)

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

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2022-06-03
- 2.0.0-beta.1 (beta) — 2022-03-29
- 1.1.0 — 2019-10-15
- 1.0.3 — 2019-06-10
- 1.0.2 — 2018-11-10
- 1.0.1 — 2018-08-16
- 1.0.0 — 2018-08-16

## README

[![version](https://img.shields.io/npm/v/rollup-plugin-svgo.svg)]()  [![license](https://img.shields.io/github/license/porsager/rollup-plugin-svgo.svg)]()

# ✂️ `rollup-plugin-svgo`

A rollup plugin to import svg files processed with [svgo](https://github.com/svg/svgo)

> SVG files, especially those exported from various editors, usually contain a lot of redundant and useless information. This can include editor metadata, comments, hidden elements, default or non-optimal values and other stuff that can be safely removed or converted without affecting the SVG rendering result.

## Usage

```bash
npm i -D rollup-plugin-svgo
```

```js
import svgo from 'rollup-plugin-svgo'

export default {
  plugins: [
    svgo(/* options */)
  ]
}
```

### Options

If you want to skip any svgo processing you can pass
```js
{
  raw: true
}
```
in options. This will import the svg content as is.

Other options are passed directly to svgo to toggle various svgo plugins. You can find all plugins here: https://github.com/svg/svgo#what-it-can-do

Svgo options are a bit verbose to write, so see the defaults used below for how to do it:

### Defaults

```js
{
  plugins: [{
    removeViewBox: false
  }, {
    removeDimensions: true
  }]
}
```

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