Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

grunt-svgmin

sindresorhus78.1kMIT7.0.0

Minify SVG

gruntplugin, svg, vector, graphic, image, optimize, minify

readme

grunt-svgmin

Minify SVG using SVGO

Issues with the output should be reported on the SVGO issue tracker.

Install

npm install --save-dev grunt-svgmin

Usage

require('load-grunt-tasks')(grunt);

grunt.initConfig({
    svgmin: {
        options: {
            plugins: [
                {
                    name: 'preset-default',
                    params: {
                        overrides: {
                            sortAttrs: false
                        }
                    }
                }
            ]
        },
        dist: {
            files: {
                'dist/unicorn.svg': 'app/unicorn.svg'
            }
        }
    }
});

grunt.registerTask('default', ['svgmin']);

Options

The provided options are passed directly to SVGO.

Note

Per-file savings are only printed in verbose mode (grunt svgmin --verbose).