Svgo: Need a Node config example

Created on 25 Jan 2017  路  3Comments  路  Source: svg/svgo

The node module example has the line /*{ custom config object }*/, but there is no reference to what the config object should look like. Could we get an example of that?

Most helpful comment

Here's part of one of mine. I use full: true, behaviour may be different with it off.

var svgo_config = {
    full: true,
    multipass: false,
    js2svg: {
        pretty: true,
        indent: '  '
    },
    plugins: [
        { removeEditorsNSData: {
            additionalNamespaces: ['http://www.figma.com/figma/ns']}
        },
        { removeDesc: {removeAny: true} },
        // 'removeTitle', // This doesn't actually enable disabled by default plugins
        { removeTitle: {} }, // pass it an argument to enable
        'removeComments', // does enable default plugins. (using { full: true } )
        'removeMetadata',
    ]
};
var svgo = new SVGO(svgo_config);

All 3 comments

Well, it's same as in docs, just in a form of JSON.

Here's part of one of mine. I use full: true, behaviour may be different with it off.

var svgo_config = {
    full: true,
    multipass: false,
    js2svg: {
        pretty: true,
        indent: '  '
    },
    plugins: [
        { removeEditorsNSData: {
            additionalNamespaces: ['http://www.figma.com/figma/ns']}
        },
        { removeDesc: {removeAny: true} },
        // 'removeTitle', // This doesn't actually enable disabled by default plugins
        { removeTitle: {} }, // pass it an argument to enable
        'removeComments', // does enable default plugins. (using { full: true } )
        'removeMetadata',
    ]
};
var svgo = new SVGO(svgo_config);

Having to look into the issues to understand how to configure for nodejs... This should be properly documented

Was this page helpful?
0 / 5 - 0 ratings