figma-export-icons-2
v1.4.1
Published
Script to generate and download icons from a figma file
Downloads
8
Readme
figma-export-icons-2
Command line script to export and download icons from a Figma file using the Figma REST api.
This cli application is extended version of figma-export-icons. I have made few changes to download the icons in multiple format.
Description
Running the script will bring up a wizard to fill in the config for fetching the assets. You can also provide the icons-config.json yourself, then the wizard is skipped. After the config is provided, the figma file is fetched and parsed to find the icons frame, the files are downloaded and put locally in the directory provided in the config.
example config file:
{
"figmaPersonalToken": "YOUR_PERSONAL_TOKEN",
"fileId": "FILE_ID",
"page": "Identity",
"frame": "Icons",
"iconsPath": "assets/svg/icons",
"format": "svg",
"scale": 4
}
Features
- Wizard to generate config, you will be prompted for any missing key
- icons-config.json is automatically added to .gitignore if it exists
- Directory to save the icons is created if it doesn't exist
- Icons are deleted from local directory when fetching new
- Icons with the same name are marked with
${iconName}-duplicate-name.svg
so you can easily spot them and fix figma file - Running the script with
-c
will clear the config and run the wizard again - You can use a custom path to your configuration file with
--config=path/to/config.json
- You can pass the output format of image. It supports jpg, png, svg, and pdf.
- For png, jpg and pdf it supports scale property.
Installation
Install the cli globally so you can use it on any directory
npm install -g figma-export-icons
Or if you prefer install it in your project
npm install figma-export-icons --save
Usage
If you have installed the module globally:
export-icons
If you have installed it locally:
Create a script in your package.json
scripts: {
'export-icons': 'export-icons'
}
and run
npm run export-icons
OR
run it directly with:
npx export-icons
For running it as a cli app:
- clone the app or download zip from repo
- run cli.js:
node cli.js
Credits
This script was developed and is part of our tools at Zuru Tech.