1.0.0 • Published 5 years ago

rollup-plugin-svg-sprite v1.0.0

Weekly downloads
499
License
MIT
Repository
github
Last release
5 years ago

rollup-plugin-svg-sprite

Build Status Codecov

Create external svg sprite file from your bundle using Rollup and optimize it using SVGO.

Installation

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

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

Usage

// 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:

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.

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

minify

Type: boolean | Default: true

Minify generated svg sprite.

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

All other options are passed to svgo package which is used inside.

License

MIT

1.0.0

5 years ago

0.3.0

5 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago