T
T
tuxx2018-08-28 18:01:39
JavaScript
tuxx, 2018-08-28 18:01:39

How to make SVGO remove all fill and stroke?

I want to use gulp to collect all svg into one sprite. Before merging via gulp-svg-sprite, I minify all svgs via gulp-svgo. The settings are:

const svgo_options = {
    cleanupAttrs:               true,
    inlineStyles:               true,
    removeAttrs:                {attrs: '(stroke|fill)'},
    removeComments:             true,
    removeTitle:                true,
    removeDesc:                 true,
    removeUselessDefs:          true,
    removeMetadata:             true,
    removeEditorsNSData:        true,
    removeEmptyAttrs:           true,
    removeHiddenElems:          true,
    removeEmptyText:            true,
    removeEmptyContainers:      true,
    minifyStyles:               true,
    removeUnknownsAndDefaults:  true,
    removeUselessStrokeAndFill: true,
    cleanupIDs:                 false,
};

fill and stroke are not removed, and because of this, their color on the page cannot be changed via css. In removeAttrs passed and just true.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question