rollup-plugin-svgsprite-generator

Create external svg sprite

Usage no npm install needed!

<script type="module">
  import rollupPluginSvgspriteGenerator from 'https://cdn.skypack.dev/rollup-plugin-svgsprite-generator';
</script>

README

Rollup plugin SVG Sprite Generator

Rollup plugin to generate external svg sprite file.

Installation:

npm i rollup-plugin-svgsprite-generator

Usage

rollup.config.js

 import { svgSprite } from 'rollup-plugin-svgsprite-generator';
 ...
 export default [
    {
       ...
       plugins:[
         svgSprite({
            input: 'folder with svg',
            output: 'path to generated sprite',
         })
       ]
    }
 ]

Configuration

minify

Type : boolean | Default: true

Minify svg sprite

doctype

Type : boolean | Default: true

Include DOCTYPE header

xml

Type : boolean | Default: true

Include <xml> tag

inlineStyles

Type : boolean | Default: true

Inline styles to paths

idConvert

Type : function | Default: id => id

Input value is string. Return value is string.

Function to modyfy id for symbol.

styleModification

Type : function | Default: id => id

Input value is object. Return value is object.

Function to modify inlined styles

output

Type : string

output svg sprite file path

input

Type : string

input folder with SVG-s

postGenerate

Type : function | Default ids => { }

Function called after sprite renerated.