ben-eb / metalsmith-svgo

Compress SVG with Metalsmith.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compress SVG with Metalsmith.

If you have any issues with the output of this plugin, please use the svgo tracker.

Install

With npm do:

npm install metalsmith-svgo --save

Example

var svgo       = require('metalsmith-svgo'),
    Metalsmith = require('metalsmith');

Metalsmith('fixtures')
    .use(svgo())
    .build(function (err) {
        if (err) {
            throw err;
        }
    });

With custom options:

Metalsmith('fixtures')
    .use(svgo({
        plugins: [{
            removeDoctype: false
        }, {
            removeComments: false
        }, {
            cleanupNumericValues: {
                floatPrecision: 2
            }
        }, {
            convertColors: {
                names2hex: false,
                rgb2hex: false
            }
        }]
    }))
    .build(function (err) {
        if (err) {
            throw err;
        }
    });

Options

See the svgo documentation.

Contributing

Pull requests are welcome. If you add functionality, then please add unit tests to cover it.

License

MIT © Ben Briggs

About

Compress SVG with Metalsmith.

License:MIT License


Languages

Language:JavaScript 100.0%