gatsby-plugin-svg-sprite
gatsby-plugin-svg-sprite copied to clipboard
💟 svg-sprite plugin for Gatsby
trafficstars
gatsby-plugin-svg-sprite
svg-sprite plugin for Gatsby
Table of contents
- Installation
- Usage
- License
Installation
Install gatsby-plugin-svg-sprite via npm.
npm install gatsby-plugin-svg-sprite --save
Add gatsby-plugin-svg-sprite to your plugins in gatsby-config.js.
module.exports = {
plugins: ['gatsby-plugin-svg-sprite'],
}
Usage
import twitterIcon from './path/to/twitter.svg'
const Icon = () => (
<svg>
<use xlinkHref={`#${twitterIcon.id}`} />
</svg>
)
License
MIT License
Copyright (c) 2018 Marco Biedermann