1.0.0 ā¢ Published 4 years ago
rollup-plugin-svg-store v1.0.0
rollup-plugin-svg-store
š£ A Rollup plugin which imports a Rollup bundle as a string.
Requirements
This plugin requires an LTS Node version (v8.0.0+) and Rollup v1.20.0+.
Install
Using npm:
npm install rollup-plugin-svg-store --save-dev
Usage
Assuming a src/index.js
exists and contains code like the following:
import icons from './icons/*.svg';
console.log(icons);
Create a rollup.config.js
configuration file and import the plugin:
import svgStore from 'rollup-plugin-svg-store';
export default {
input: 'src/index.js',
output: {
dir: 'output',
format: 'cjs'
},
plugins: [svgStore()]
};
Then call rollup
either via the CLI or the API.
Options
store
Type: Object
Default: {}
The options to forward to svgstore
.
optimize
Type: Object
Default: {}
The options to forward to svgo
.
prefix
Type: String
Default: ""
The string to prepend to every icon ID.
exclude
Type: String
| Array[...String]
Default: null
A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should ignore. By default no files are ignored.
include
Type: String
| Array[...String]
Default: null