Skip to content

hbk619/svg-to-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SVG to Components

Turn your svg files into React components, allows for:

import { Star } from './components/icons';

const App = () => (
  <div>
    <Star />
  </div>
);

or

import * as Icons from './components/icons';

const App = () => (
  <div>
    <Icons.Star />
  </div>
);

To create icons:

From node

const componentiser = require('svg-to-components');

componentiser.create({
    src: 'my/src/dir',
    output: 'my/out/dir'
});

From command line

svg-to-react --src images --output output/dir

More info

svg-to-react --help

Inspired by https://github.com/pedronauck/reicons#readme re-written with async/await, less dependencies, and tests

Developing

yarn install
yarn test
yarn test:command

TODO

Make it recursive (optionally)

About

Convert svgs into React components

Resources

Stars

Watchers

Forks

Packages

No packages published