一覧へ戻る
nolanlawson/rollup-plugin-svg-to-jsx(新しいタブで開きます)
主要言語: JavaScript
Rollup plugin for svg-to-jsx
- star 数
- 3
- watcher 数
- 1
- fork 数
- 2
- issue 数
- 0
- 最終更新
- 2017/10/03
主要言語: JavaScript
Rollup plugin for svg-to-jsx
Rollup plugin for svg-to-jsx.
npm install rollup-plugin-svg-to-jsx
// 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 }) ] }
Following react-svg-loader, the output format is:
import React from "react"; export default props => <svg {...props}>{svgContent}</svg>;