javascript - svgo removeAttrs how to specify attrs to remove - Stack Overflow

I have removeAttrs set to true, I would like to remove all fill, and color: {loader: 'svgo-loader&

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...

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...

Share Improve this question edited Apr 21, 2017 at 19:41 Robert Longson 125k27 gold badges267 silver badges253 bronze badges asked Apr 21, 2017 at 9:33 palyxkpalyxk 3512 gold badges5 silver badges17 bronze badges 5
  • removeUselessStrokeAndFill ?? – Sahil Dhir Commented Apr 21, 2017 at 9:35
  • No remove useless stroke and fill i have tried.. – palyxk Commented Apr 21, 2017 at 9:37
  • Please provide full code – Sahil Dhir Commented Apr 21, 2017 at 9:41
  • thats cool :) :) – Sahil Dhir Commented Apr 21, 2017 at 9:51
  • 1 Could somebody enlighten me as on how to use this on the mand line? I want to get rid of a lot of 'forbidden' data-name attributes in a bunch of SVG files. “svgo . enable=removeAttrs data-name” doesn't work. – Ideogram Commented Aug 24, 2017 at 7:21
Add a ment  | 

1 Answer 1

Reset to default 5

I solved it like this:

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745348562a4623686.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信