Figma Export is a library that allows you to export resources from Figma into your project. It automatically generates
a .figma-export.json
file that contains settings for exporting resources.
To install the library, run the following command:
npm install -g figma-export-js
or if you are using yarn:
yarn global add figma-export-js
After installation, you can use the figma-export
command in the command line.
To start working with the library, you need to initialize a configuration file. To do this, run the command:
figma-export init
This command will create a .figma-export.json
file with basic settings.
In the .figma-export.json
file, you can specify the following settings:
scss
: Path for exporting SCSS filesicons
: Path for exporting iconsimages
: Path for exporting images
In addition to the settings in the .figma-export.json
file, you also need to set up environment variables in a .env
file in the root of your project. The required environment variables are:
FIGMA_API_KEY
: Your Figma API keyFIGMA_FILE_ID
: The ID of your file in Figma
Here is an example of what your .env
file might look like:
FIGMA_API_KEY=your-figma-api-key
FIGMA_FILE_ID=your-figma-file-id
Please replace your-figma-api-key
and your-figma-file-id
with your actual Figma API key and file ID.
Remember to add the .env
file to your .gitignore
file to prevent it from being committed to your repository.
After setting up the configuration file, you can start exporting resources. To do this, simply run the figma-export
command without arguments:
figma-export
This command will export all resources specified in the .figma-export.json
file to the corresponding directories.
Figma Export is distributed under the MIT license.