This project will export SVG, Sprite, React Components from a simple Figma Icon project.
We use @figma-export to export Figma Components so Please read their docs and try to get comfortable with their concepts.
With @figma-export we export to handle SVG creation for each Figma Component and then with transform-svg-with-svgo we optimize the exported SVGs. this is a transformer and you can add/remove/update SVG attributes with it.
-
@figma-export/output-components-as-svg We use this to generate
SVGfiles, you can check them insvgfolder. -
@figma-export/output-components-as-es6 We use this to generate
ES6modules forSVGs. you can check them insrc/es6folder. -
@figma-export/output-components-as-svgr We use this to generate
ReactComponents based ontransformed ( optimized ) SVGfiles. you can check them insrc/reactfolder. -
@figma-export/output-components-as-svgstore We use this to generate
SVG Spritebased on thetransformed ( optimized ) SVGfiles. you can check them inspritefolder.
- node >=16.16.0
- npm >=7.21.0
- git (for
contribution) - Figma Token ( Check This to set it up for yourself )
- Figma File Id, for now you can use
XegjSl9fWXH2O7Mxo0Ctie - Figma icons page, for now you can use
deriv-icons
-
Enter project directory
cd deriv-icons -
Setup .env file create a .env file inside
deriv-iconsfolder with this content:FIGMA_TOKEN=YOUR_FIGMA_TOKEN FILE_ID=XegjSl9fWXH2O7Mxo0Ctie ICONS_PAGE=deriv-icons -
Install your dependencies:
npm ci
-
Export:
npm run export -
Run Storybook
npm start
For now we don't have any conventions yet, but after coordintating with design team will update this section.
We use rollup for package bundling, in order to build the actual package you do the following:
-
Setup .env file Configure the environment variables of the platform with these:
FIGMA_TOKEN=YOUR_FIGMA_TOKEN FILE_ID=XegjSl9fWXH2O7Mxo0Ctie ICONS_PAGE=deriv-icons -
Install your dependencies:
npm ci
-
Export:
npm run export -
Build Storybook
```sh npm build_and_publish ``` the built version of the package will be in `dist` folder, in case you wanna run some auditing tool on it.Note: You have to change the
versionfield inpackage.jsonfile. please use semver versioning
Since we storybooks as visual testing of components for deployments on vercel, etc you can do:
-
Setup .env file Configure the environment variables of the platform with these:
FIGMA_TOKEN=YOUR_FIGMA_TOKEN FILE_ID=XegjSl9fWXH2O7Mxo0Ctie ICONS_PAGE=deriv-icons -
Install your dependencies:
npm ci
-
Export:
npm run export -
Build Storybook
npm build-storybook
The built static release of storybooks will be under storybook-static folder, you can use this folder for deployment.