# rollup-plugin-svg-sprite

> Create external svg sprite from your bundle using Rollup

Latest version **1.0.0** (published 2019-07-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install rollup-plugin-svg-sprite
pnpm add rollup-plugin-svg-sprite
yarn add rollup-plugin-svg-sprite
bun add rollup-plugin-svg-sprite
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-07-25 |
| First published | 2018-01-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8.3 |
| Dependencies | 3 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 21 |
| Author | Vlad Shcherbin |
| Maintainers | shcherbin |
| Keywords | rollup, rollup-plugin, svg, sprite, svg-sprite, svgo, create, generate, extract, minify |

## Links

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

## Dependencies (3)

- [svgo](https://npm.io/package/svgo.md) ^1.3.0
- [cheerio](https://npm.io/package/cheerio.md) ^1.0.0-rc.3
- [fs-extra](https://npm.io/package/fs-extra.md) ^8.1.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

- 1.0.0 (latest) — 2019-07-25
- 0.3.0 — 2019-06-08
- 0.2.0 — 2018-01-27
- 0.1.1 — 2018-01-27
- 0.1.0 — 2018-01-27

## README

# rollup-plugin-svg-sprite

[![Build Status](https://travis-ci.org/vladshcherbin/rollup-plugin-svg-sprite.svg?branch=master)](https://travis-ci.org/vladshcherbin/rollup-plugin-svg-sprite)
[![Codecov](https://codecov.io/gh/vladshcherbin/rollup-plugin-svg-sprite/branch/master/graph/badge.svg)](https://codecov.io/gh/vladshcherbin/rollup-plugin-svg-sprite)

Create external svg sprite file from your bundle using Rollup and optimize it using [SVGO](https://github.com/svg/svgo).

## Installation

```bash
# yarn
yarn add rollup-plugin-svg-sprite -D

# npm
npm install rollup-plugin-svg-sprite -D
```

## Usage

```js
// rollup.config.js
import svgSprite from 'rollup-plugin-svg-sprite'

export default {
  input: 'src/index.js',
  output: {
    file: 'dist/app.js',
    format: 'iife'
  },
  plugins: [
    svgSprite({
      outputFolder: 'dist/public'
    })
  ]
}
```

Next, import svg files in your project:

```js
import './svg/trash.svg'
import './svg/user.svg'
```

### Configuration

There are some useful options:

#### outputFolder

Type: `string`

Folder where generated svg sprite will be saved.

```js
svgSprite({
  outputFolder: 'dist/public'
})
```

#### minify

Type: `boolean` | Default: `true`

Minify generated svg sprite.

```js
svgSprite({
  outputFolder: 'dist/public',
  minify: false
})
```

All other options are passed to [svgo package](https://github.com/svg/svgo) which is used inside.

## License

MIT

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