Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

parcel-plugin-svg-react

Package Overview
Dependencies
6
Maintainers
1
Versions
5
Issues
File Explorer

Advanced tools

parcel-plugin-svg-react

Import SVG as React components (Parcel plugin)

    1.0.4latest
    GitHub

Version published
Maintainers
1
Weekly downloads
409
increased by8.78%

Weekly downloads

Readme

Source

parcel-plugin-svg-react

Parcel plugin for SVGR. Forked from @svgr/parcel-plugin-svgr.

npm install parcel-plugin-svg-react

The Differences

  • .svgr extension for React imports
  • .svg extension for path imports
  • Allows CSS imports

React Imports

Allows to import SVG files as React components. The extension should be .svgr, not .svg!

import Star from './star.svgr' const App = () => ( <div> <Star /> </div> )

Usual Behavior

Allows to import .svg files as paths (the usual Parcel behavior):

import star from './star.svg' const Star = () => ( <div style={{ backgroundImage: `url(${ star })` }}></div> )

CSS Imports

This works as well:

div { background-image: url(./star.svg); }

Keywords

FAQs

Last updated on 02 May 2020

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.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc