Nonlinear Performance Magnification

    @svgr/plugin-jsx
    TypeScript icon, indicating that this package has built-in type declarations

    6.2.1 • Public • Published

    @svgr/plugin-jsx

    Build Status Version MIT License

    Transforms SVG into JSX.

    Install

    npm install --save-dev @svgr/plugin-jsx
    

    Usage

    .svgrrc

    {
      "plugins": ["@svgr/plugin-jsx"]
    }

    How does it work?

    @svgr/plugin-jsx consists in three phases:

    Applying custom transformations

    You can extend the Babel config applied in this plugin using jsx.babelConfig config path:

    // .svgrrc.js
    
    module.exports = {
      jsx: {
        babelConfig: {
          plugins: [
            // For an example, this plugin will remove "id" attribute from "svg" tag
            [
              '@svgr/babel-plugin-remove-jsx-attribute',
              {
                elements: ['svg'],
                attributes: ['id'],
              },
            ],
          ],
        },
      },
    }

    Several Babel plugins are available:

    If you want to create your own, reading Babel Handbook is a good start!

    License

    MIT

    Keywords

    Install

    npm i @svgr/plugin-jsx

    DownloadsWeekly Downloads

    5,392,062

    Version

    6.2.1

    License

    MIT

    Unpacked Size

    13.7 kB

    Total Files

    6

    Last publish

    Collaborators

    • neoziro