Search code examples
javascriptsvgloader

svgo removeAttrs how to specify attrs to remove


I have removeAttrs set to true, I would like to remove all fill, and color:

{
    loader: 'svgo-loader',
    options: {
      plugins: [
        { removeNonInheritableGroupAttrs: true },
        { collapseGroups: true },
        { removeAttrs: true },
      ],
    },
  },

But I don´t know how to specify attrs to remove in there...


Solution

  • I solved it like this:

    {
      loader: 'svgo-loader',
      options: {
        plugins: [
          { removeNonInheritableGroupAttrs: true },
          { collapseGroups: true },
          { removeAttrs: { attrs: '(fill|stroke)' } },
        ]
      }
    }