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

8.1.0 • 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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
8.1.04,554,546latest
6.0.0-alpha.4154next

Version History

VersionDownloads (Last 7 Days)Published
8.1.04,554,546
8.0.1210,572
8.0.02,233
7.0.0151,630
6.5.11,334,615
6.5.09,886
6.4.09,083
6.3.149,062
6.3.01,912
6.2.189,509
6.2.05,821
6.1.215,821
6.1.01,624
6.0.01,350
6.0.0-alpha.4154
6.0.0-alpha.31
6.0.0-alpha.23
6.0.0-alpha.11
6.0.0-alpha.09
5.5.03,205,429
5.4.065,733
5.3.11,168
5.3.02,203
5.2.01,301
5.0.1128
5.0.012
4.3.3463,643
4.3.28,579
4.3.1934
4.3.02,479
4.2.07,535
4.1.03,340
4.0.38
4.0.21
4.0.11
4.0.01

Package Sidebar

Install

npm i @svgr/plugin-jsx

Weekly Downloads

10,200,327

Version

8.1.0

License

MIT

Unpacked Size

12.8 kB

Total Files

6

Last publish

Collaborators

  • neoziro
OSZAR »