Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svg2react-icon

Package Overview
Dependencies
Maintainers
8
Versions
565
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg2react-icon

  • 3.1.153
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14K
increased by4.85%
Maintainers
8
Weekly downloads
 
Created
Source

svg2react-icon

A library to generate reusable React Icon components from raw SVG icons

Features

  • Create a React Icon component file for each raw SVG icon file
  • Rename illegal SVG attributes
  • Optimize the SVG (remove comments, unnecessary parts, etc)
  • Remove colors so that the parent's font-color will be cascaded to the icon
  • Optional - output TypeScript components

Install

npm install --save-dev svg2react-icon

Sample usage

In your package.json:

{
  "scripts": {
    "build": "svg2react-icon [options] <inputDir> <outputDir>",
    ...
  }
}

Or in the command-line:

svg2react-icon [options] <inputDir> <outputDir>

By default, the files that will be generated are:

outputDir
|
+ -- index.ts
|
+ -- components
    |
    Icon1.tsx
    ... 

By using the --no-sub-dir the index file and all the icons will be generated in the outputDir without the extra components folder.

Options:

  --typescript    generate TypeScript components instead of JS
  --monochrome    strip all fill and stroke attributes
  --named-export  use named export instead of export default
  --keep-colors   keep svg fill and stroke colors
  --no-sub-dir    Output index file and components all inside the output directory

License

MIT

FAQs

Package last updated on 02 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc