Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cartersusi/reactify-my-svg

Convert SVG into react components via CLI
https://github.com/cartersusi/reactify-my-svg

cli linux macos react svg

Last synced: 13 days ago
JSON representation

Convert SVG into react components via CLI

Awesome Lists containing this project

README

        

# Reactify my SVG
* Turn SVG files into React components.
* Replace hyphens with camelCase in an SVG file.

## Installation
```sh
git clone https://github.com/cartersusi/reactify-my-svg.git
cd reactify-my-svg
chmod +x install.sh
./install.sh
```
or
```sh
git clone https://github.com/cartersusi/reactify-my-svg.git && cd reactify-my-svg && chmod +x install.sh && ./install.sh
```

## Usage
```
reactify [-h] -i INPUT -o OUTPUT [-p]
Replace hyphens with camelCase in an SVG file.

options:
-h, --help show this help message and exit
-i INPUT, --input INPUT
Input SVG file
-o OUTPUT, --output OUTPUT
Output JS/TS file
-p, --props Add props to the output file
```

## Examples
### JS/JSX

```sh
reactify -i test.svg -o main.js
```

```js
export function main() {
return (



SVG

);
}
```

### TS/TSX with props
```sh
reactify -i test.svg -o main.tsx -p
```

```tsx
export function main(props:any) {
return (



SVG

);
}
```