This repo uses SVGR and allows you to convert svg file to React components
- Install dependencies
yarn
- Create svg (input) and components (ouput) folders
yarn setup
- Put your svgs in the
svg
folder
yarn build:svg
The components will be created in the components
folder
In this file you can customise the SVGR options. Here you can specify
- Which props you want to add to the SVG tag
- Which values in the svg file you want to replace and the new values to use
- A lot more... (you can find more info in the SVGR docs)
The script uses prettier, so you can just add rules here to modify the output
This is the template for the SVG React component.
This is the template for the barrel file that will export all the components created