kristerkari / react-native-svg-transformer

Import SVG files in your React Native project the same way that you would in a Web application.
MIT License
1.54k stars 116 forks source link

[Question] Should additional SVGO plugins work? #274

Open OttoLaitinen opened 1 year ago

OttoLaitinen commented 1 year ago

I have tried to add the SVGO plugin convertStyleToAttrs to be able to use replaceAttrValues as the replacement only works for attributes and not for inline styles.

This is my SVG code:

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
     viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
    .st0{fill-rule:evenodd;clip-rule:evenodd;fill:#000000;}
</style>
<path class="st0" d="M20.7,19.3c0.4,0.4,0.4,1,0,1.4s-1,0.4-1.4,0L12,13.4l-7.3,7.3c-0.4,0.4-1,0.4-1.4,0c-0.4-0.4-0.4-1,0-1.4
    l7.3-7.3L3.3,4.7c-0.4-0.4-0.4-1,0-1.4c0.4-0.4,1-0.4,1.4,0l7.3,7.3l7.3-7.3c0.4-0.4,1-0.4,1.4,0c0.4,0.4,0.4,1,0,1.4L13.4,12
    L20.7,19.3z"/>
</svg>

And this is my svgrrc.js:

module.exports = {
  replaceAttrValues: {
    "#000000": "currentColor",
  },
  svgo: true,
  svgoConfig: {
    plugins: ["convertStyleToAttrs"],
  },
};

For some reason, the additional plugin doesn't seem to be registered because when I'm looking at the non source mapped JS code the