react-svg-to-tsx

0.0.2 • Public • Published

svg-to-tsx

A node module and cli for converting svg:s to tsx (Typescript jsx components)

Usage

# Outputs to stdout 
svg-to-tsx icons.svg
 
# Use --jsx to specify jsx import statement. Below is the default 
svg-to-tsx --jsx "import * as React from 'react'" icons.svg
 
# Override the name of the exported component (defaults to identifierified file name) 
svg-to-tsx --name Logo smth.svg
import * as fs from 'fs'
import { svgToTsx } from 'svg-to-tsx'
 
let tsxSource = await svgToTsx(fs.readFileSync('icon.svg').toString(), { name: 'MyIcon' })

Readme

Keywords

Package Sidebar

Install

npm i react-svg-to-tsx

Weekly Downloads

2

Version

0.0.2

License

ISC

Unpacked Size

3.11 kB

Total Files

3

Last publish

Collaborators

  • real.nuts