0.0.2 • Published 4 years ago

react-svg-to-tsx v0.0.2

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

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' })
0.0.2

4 years ago