Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.
/ svg2jsx Public archive
forked from kokjinsam/svg-to-jsx

⚛ Transform SVG to valid JSX

License

Notifications You must be signed in to change notification settings

brave/svg2jsx

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

svg2jsx 🌓

Tiny module for transforming SVG to valid JSX

npm version

Install ⚙

yarn add @balajmarius/svg2jsx --dev

Test ⛱

yarn test

Use 🛠

const fs = require('fs')
const path = require('path')
const svg2jsx = require('@balajmarius/svg2jsx')

const filepath = path.resolve(__dirname, 'test.svg')

fs.readFile(filepath, 'utf8', (error, data) => {

  if (error) throw new Error('😞 Something went wrong')

  return svg2jsx(data)
    .then(transformedSVG => console.log(transformedSVG))
    .catch(error => console.log(error))

})

About

⚛ Transform SVG to valid JSX

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%