/porg

Convert SVG to JSX

Primary LanguageJavaScript

Porg

Convert SVG to JSX

porg.svg

From .svg

<svg xmlns="http://www.w3.org/2000/svg">
  <g></g>
</svg>

To .js

import React from "react";

export default = (
  <svg xmlns="http://www.w3.org/2000/svg">
    <g></g>
  </svg>
);

Usage

$ porg [options] <path>

Options:

    -d, --delete     delete source file(s)
    -r, --recursive  process folders recursively
    -V, --version    output the version number
    -h, --help       output usage information

Dependencies

git | node 8 | npm

yarn brew install yarn --without-node

Installation

$ git clone git@github.com:monospaced/porg.git
$ cd porg
$ yarn && yarn link

Examples

File

$ porg ./test/test.svg

./test/test.js

Directory

$ porg ./test

./test/test.js
./test/etc.js
…