parcel-plugin-svg-react
Advanced tools
Weekly downloads
Readme
Parcel plugin for SVGR. Forked from @svgr/parcel-plugin-svgr.
npm install parcel-plugin-svg-react
.svgr
extension for React imports.svg
extension for path importsAllows to import SVG files as React components. The extension should be .svgr
, not .svg
!
import Star from './star.svgr'
const App = () => (
<div>
<Star />
</div>
)
Allows to import .svg
files as paths (the usual Parcel behavior):
import star from './star.svg'
const Star = () => (
<div style={{ backgroundImage: `url(${ star })` }}></div>
)
This works as well:
div {
background-image: url(./star.svg);
}
FAQs
Import SVG as React components (Parcel plugin)
The npm package parcel-plugin-svg-react receives a total of 397 weekly downloads. As such, parcel-plugin-svg-react popularity was classified as not popular.
We found that parcel-plugin-svg-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.