figma-token-converter
v1.0.2
Published
A tool to fetch and transform Figma tokens to JSON and SCSS formats
Downloads
207
Maintainers
Readme
figma-token-converter
Convert Figma design tokens to JSON and SCSS formats.
Installation
npm install figma-token-converter
Usage
Setup
Create a .env.local file with your Figma API token and file key:
FIGMA_TOKEN=your_figma_token_here
FIGMA_FILE_KEY=your_figma_file_key_here
const figmaConverter = require('figma-token-converter');
figmaConverter.fetchTokens({ figmaFileId, accessToken })
.then(tokens => figmaConverter.toJSON(tokens))
.then(json => console.log(json))
.catch(console.error);
6. Build Scripts
For packaging, add a build script to package.json
:
"scripts": {
"build": "babel src -d lib",
"test": "jest",
"prepublish": "npm run build"
}