Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/VladShcherbin/rollup-plugin-svg-sprite
Create external svg sprite file from your bundle using Rollup
https://github.com/VladShcherbin/rollup-plugin-svg-sprite
create extract generate minify rollup rollup-plugin sprite svg svg-sprite svgo
Last synced: 3 months ago
JSON representation
Create external svg sprite file from your bundle using Rollup
- Host: GitHub
- URL: https://github.com/VladShcherbin/rollup-plugin-svg-sprite
- Owner: vladshcherbin
- Created: 2018-01-27T11:22:48.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-06-28T13:22:59.000Z (over 3 years ago)
- Last Synced: 2024-05-07T05:01:51.880Z (6 months ago)
- Topics: create, extract, generate, minify, rollup, rollup-plugin, sprite, svg, svg-sprite, svgo
- Language: JavaScript
- Homepage:
- Size: 339 KB
- Stars: 20
- Watchers: 1
- Forks: 5
- Open Issues: 7
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
- awesome - svg-sprite
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