benboba / rollup-plugin-svg-slim

The loader plugin of rollup, reads svg files and compresses them with svg-slim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rollup-plugin-svg-slim

rollup plug-in, read the svg file and use svg-slim to compress

Installation

npm install rollup-plugin-svg-slim -D

or

yarn add rollup-plugin-svg-slim -D

Configuration

The following is the schematic code in rollup.config.js

Use default configuration

import svgs from 'rollup-plugin-svg-slim';
export default ({
    ...
	plugins: [svgs()],
    ...
});

Custom configuration

For custom configuration, please refer to the documentation of svg-slim

import svgs from 'rollup-plugin-svg-slim';
export default ({
    ...
	plugins: [
        svgs({
            rules: {
                'shorten-decimal-digits': false,
                'shorten-id': false,
            },
            params: {
                sizeDigit: 2,
                angelDigit: 2,
            },
        }),
    ],
    ...
});

About

The loader plugin of rollup, reads svg files and compresses them with svg-slim

License:MIT License


Languages

Language:JavaScript 100.0%