rollup-plugin-svg-to-jsx
v1.0.0
Published
Rollup plugin for svg-to-jsx
Downloads
3,411
Readme
rollup-plugin-svg-to-jsx
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>;