English | 한국어
Figmable is a CLI tool that helps you sync color variables from your Figma design files directly to your CSS files. It extracts color variables from Figma and automatically updates your CSS files with the new color variables, making the design-to-development workflow seamless.
# 1. Save your configuration (one-time setup)
figmable config --fileKey YOUR_KEY --token YOUR_TOKEN --path ./src/styles/global.css
# 2. Run Figmable - That's it! 🎉
figmable
# Your CSS is now updated with Figma color variables!Just two commands and you're done! Figmable will:
- Fetch your color variables from Figma
- Save them as JSON for reference
- Automatically update your CSS file
- Create a backup, just in case
🎨 Why Figmable?
While Figma provides a/variablesAPI endpoint to fetch local variables, it's only available for paid plans. Figmable offers a free alternative by extracting color codes from your Figma color palette and converting them into CSS variables!
- 🎨 Extract color variables from Figma files
- 🔄 Automatically sync with your CSS files
- 🔒 Preserve existing CSS variables
- 💾 Automatic backup of CSS files before updating
- 📦 Easy to integrate into your workflow
- ⚡️ Simple configuration management
-
Figma API Token
- Go to Figma > Account Settings > Access tokens
- Create a new access token
- Copy the token for later use
-
Figma File Key
- Open your Figma file in browser
- Copy the key from URL:
figma.com/file/YOUR_FILE_KEY/...
-
Figma Color Objects
- Name your color objects with
--prefix (e.g.,--primary-500,--orange-600) - This naming convention is required for Figmable to identify and extract color variables
- Example:
--primary-500 → #3B82F6 --orange-600 → #EA580C --neutral-900 → #171717
-
CSS File
-
Must have
:rootselector in your CSS -
Example:
/* With Tailwind */ @layer base { :root { /* Your CSS variables will be added here */ --primary: #000000; } } /* Or without Tailwind, simple CSS is fine too */ :root { /* Your CSS variables will be added here */ --primary: #000000; }
-
npm install -g figmableFirst, save your Figma credentials and file paths:
figmable config \
--fileKey YOUR_FIGMA_FILE_KEY \
--token YOUR_FIGMA_API_TOKEN \
--path ./path/to/your/global.cssCheck your saved configuration:
figmable showThis will display:
- Figma file key and URL
- API token
- File paths
- Configuration file location (which you can edit directly)
After configuration, simply run:
figmableThis will:
- Fetch color variables from your Figma file
- Save them to
figma-variables.json - Update your CSS file
- Create a backup of your CSS file (
.bak)
Override configuration for a single run:
figmable \
--fileKey DIFFERENT_KEY \
--token DIFFERENT_TOKEN \
--path ./different/path.css \
--output ./different/variables.jsonDisable backup file creation:
figmable --no-backup
# or
figmable -nbEnable backup file creation (default behavior):
figmable --backup
# or just
figmable.figmablerc: Configuration file (automatically created in home directory)figma-variables.json: Extracted Figma variables (created in project directory)your-css-file.css.bak: Backup file (created alongside CSS file)
Figmable provides clear error messages for common issues:
- Invalid Figma API token
- File access permissions
- Missing or invalid file paths
- JSON parsing errors
- CSS file modification errors
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
Byungsker
Figmable은 Figma 디자인 파일에서 색상 변수를 CSS 파일로 직접 동기화하는 CLI 도구입니다. Figma에서 색상 변수를 추출하고 새로운 색상 변수로 CSS 파일을 자동으로 업데이트하여 디자인-개발 워크플로우를 원활하게 만듭니다.
