npm.io
0.11.0 • Published 8 years ago

docz-plugin-svgr

Licence
MIT
Version
0.11.0
Deps
2
Size
7 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

docz-plugin-svgr

This plugin allow you to use svgr as loader for svg images together with default file-loader

Install

$ yarn add docz-plugin-svgr

Usage

Just import the plugin and add it on your doczrc.js

import { svgr } from 'docz-plugin-svgr'

export default {
  plugins: [svgr()]
}

Then just use named imports to import using svgr

import starUrl, { ReactComponent as Star } from './star.svg'

const App = () => (
  <div>
    <img src={starUrl} alt="star" />
    <Star />
  </div>
)

Custom options

If you want to pass custom options for @svgr/webpack just pass as first argument of the functio

import { svgr } from 'docz-plugin-svgr'

export default {
  plugins: [svgr({ native: true })]
}