Skip to content

ben-eb/metalsmith-svgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Resources

License

Stars

Watchers

Forks

Packages

No packages published