1.0.0 • Published 7 years ago

rollup-plugin-svg-to-jsx v1.0.0

Weekly downloads
487
License
Apache-2.0
Repository
github
Last release
7 years ago

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>;