1.1.0 • Published 6 years ago
rollup-inline-svg v1.1.0
rollup-inline-svg
Inline SVG files
Installation
npm install --save-dev rollup-inline-svg
Usage
// rollup.config.js
import inlineSVG from 'rollup-inline-svg';
export default {
input: './input.js',
output: {
file: './output.js',
format: 'cjs',
},
plugins: [
inlineSVG({
// process SVG to String or DOM Node. Default: false
stringify: false
}),
],
};
You can now use SVG in your bundle like so:
import compass from './compass.svg';
import star from './star.svg';
document.body.appendChild(compass());
// with attributes override
document.body.appendChild(star({
fill: '#e91e63',
class: 'icon'
}));
License
MIT