jpavlicek / gatsby-plugin-svgr

svgr plugin for gatsby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gatsby-plugin-svgr npm version

SVGR plugin for Gatsby

These are the docs for v1.x.x. The docs for v0.x.x are here

Installing

$ npm install gatsby-plugin-svgr

or

$ yarn add gatsby-plugin-svgr

Setup

Add it to your gatsby-config.js

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-plugin-svgr',
      options: {
        icon: true,
        viewBox: false,
        // see https://github.com/smooth-code/svgr for a list of all options
      },
    },
  ],
}

Usage

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

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

About

svgr plugin for gatsby

License:MIT License


Languages

Language:JavaScript 100.0%