babel-plugin-react-primitives-svg

A babel plugin that transforms SVG imports into react-primitives-svg compatible components.

Usage no npm install needed!

<script type="module">
  import babelPluginReactPrimitivesSvg from 'https://cdn.skypack.dev/babel-plugin-react-primitives-svg';
</script>

README

babel-plugin-react-primitives-svg

FOSSA Status

A babel plugin that transforms SVG imports into react-primitives-svg-compatible primitives.

🚨 This is super BETA 🚨

This is my first dip into the babel plugin pool, so any help testing or developing would be greatly appreciated.

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": [
    "babel-plugin-react-primitives-svg"
  ]
}

Options

  • verbose - Log level (boolean, default: false)
  • defaultWidth - Default pixel width for SVG (string or number, default: 100%)
  • defaultHeight - Default pixel height for SVG (string or number, default: 100%)
  • ...inherited options from babel-plugin-react-sketchapp-svg

Example:

{
  "plugins": [
    [
      "babel-plugin-react-primitives-svg",
      {
        "defaultWidth": 32,
        "defaultHeight": 32,
        "svgo": {
          "plugins": [
            {
              "removeAttrs": { "attrs": "(data-name)" }
            },
            {
              "cleanupIDs": true
            }
          ]
        }
      }
    ]
  ]
}

License

FOSSA Status