danielstgt / laravel-mix-svg-vue

A Laravel Mix extension to inline SVG files with Vue.js and automatically optimize them with SVGO
MIT License
38 stars 9 forks source link

How to use removeAttrs #13

Open phatsk opened 2 years ago

phatsk commented 2 years ago

I've attempted adding removeAttrs to my svgo settings, but I keep getting the following:

Warning: The plugin "removeAttrs" requires the "attrs" parameter.
It should have a pattern to remove, otherwise the plugin is a noop.
Config example:

plugins: [
  {
    name: "removeAttrs",
    params: {
      attrs: "(fill|stroke)"
    }
  }
]

Here is my call to svgVue:

    .svgVue({
        svgPath: 'resources/js/components/atomic/icons/',
        extract: false,
        svgoSettings: [
            { removeTitle: true },
            { removeViewBox: false },
            { removeDimensions: true },
            { removeUselessStrokeAndFill: true },
            { removeAttrs: { attrs: 'fill' } },
        ]
    })