rollup-plugin-svg-to-jsx

1.0.0 • Public • Published

rollup-plugin-svg-to-jsx Build Status

Rollup plugin for svg-to-jsx.

npm install rollup-plugin-svg-to-jsx

Config

// rollup.config.js
import svgToJsx from 'rollup-plugin-svg-to-jsx'
 
export default {
  input: './index.js',
  output: {
    file: './bundle.js',
    format: 'es'
  },
  plugins: [
    svgToJsx()
  ]
}

Or with options:

// rollup.config.js
import svgToJsx from 'rollup-plugin-svg-to-jsx'
 
export default {
  input: './index.js',
  output: {
    file: './bundle.js',
    format: 'es'
  },
  plugins: [
    svgToJsx({
      include: '**/*.svg', // anything to include, default is '**/*.svg'
      exclude: 'file-to-exclude.svg' // anything to exclude
    })
  ]
}

Output format

Following react-svg-loader, the output format is:

import React from "react";
export default props => <svg {...props}>{svgContent}</svg>;

Readme

Keywords

none

Package Sidebar

Install

npm i rollup-plugin-svg-to-jsx

Weekly Downloads

30

Version

1.0.0

License

Apache-2.0

Last publish

Collaborators

  • nolanlawson