Svgo: How to delete data-* attr?

Created on 15 Jun 2017  Â·  2Comments  Â·  Source: svg/svgo

I get

Warning: Unknown prop dataName on tag. Remove this prop from the element
How to delete data-* attr?

Most helpful comment

Warning: Unknown prop dataName on tag. Remove this prop from the element…

Where are you getting this _warning_? Seems something from react, that accept data-attributes not _camelCased_.

However you could use removeAttrs plugin to remove specific attrs.
This _plugin_ is super flexible since accepts value as regexp.

In case you won't any data-* attribute you could try with something like in your configuration Object:

plugins: [
  {
    removeAttrs: { attrs: 'data.*' }
  },
],

All 2 comments

Warning: Unknown prop dataName on tag. Remove this prop from the element…

Where are you getting this _warning_? Seems something from react, that accept data-attributes not _camelCased_.

However you could use removeAttrs plugin to remove specific attrs.
This _plugin_ is super flexible since accepts value as regexp.

In case you won't any data-* attribute you could try with something like in your configuration Object:

plugins: [
  {
    removeAttrs: { attrs: 'data.*' }
  },
],

Thanks to @elrumordelaluz for the comprehensive answer. It really doesn't seem like related to SVGO.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

madysondesigns picture madysondesigns  Â·  4Comments

pixelass picture pixelass  Â·  6Comments

bmcminn picture bmcminn  Â·  4Comments

elidupuis picture elidupuis  Â·  5Comments

onlymega picture onlymega  Â·  6Comments