Your Figma → Code sync workflow is now working! Here's everything that's been configured:
- ✅ Figma API authentication configured
- ✅ Sync script extracting colors from your design system
- ✅ Automatic updates to
index.htmlTailwind config - ✅
.envfile created with your token (gitignored) - ✅ MCP configuration updated (
.mcp.json)
Note: The sync tool is also available as a standalone repository at figma-design-tokens for use in other projects.
# Easy way (uses .env file)
export $(cat .env | xargs) && node sync-design-tokens.js- Fetches latest design from Figma
- Extracts all color tokens
- Updates
index.htmlautomatically - Saves JSON files for reference
The script extracted 7 colors from your Figma file:
| Name | Hex | Usage |
|---|---|---|
| Accent | #079E87 |
Links, CTAs |
| Background/Base | #FFFFFF |
Page background |
| light-gray | #F7F7F7 |
Borders |
| mid-gray | #DFE1E3 |
Secondary text |
| off-white | #FFFEF9 |
Card backgrounds |
| Surface/Default | #FFFEF9 |
Surface color |
| Text/Secondary | #DFE1E3 |
Secondary text |
Missing: Text/Primary (near-black) Why: The script only extracts colors that are applied to elements in your Figma document.
Option 1: Publish the Library (Recommended)
- In Figma, right-click your file
- Select "Publish styles and components"
- Publish your color styles
- Run the sync script again
Option 2: Apply All Colors
- Make sure each color style is applied to at least one element in your Figma file
| File | Purpose |
|---|---|
sync-design-tokens.js |
Main sync script |
.env |
Your Figma token (keep secret!) |
.mcp.json |
MCP server config for Claude Code |
figma_colors.json |
Extracted color data |
DESIGN_TOKENS.md |
Full design system documentation |
SYNC_WORKFLOW.md |
Complete workflow guide |
The Figma API requires the X-Figma-Token header, NOT Authorization: Bearer.
This has been fixed in:
- ✅
sync-design-tokens.js - ✅
.mcp.json
This workflow demonstrates:
- API integration skills
- Design system knowledge
- Automation and tooling
- Documentation abilities
- Problem-solving (we debugged the auth issue!)
Document this process as a case study showing:
- The problem (keeping design and code in sync)
- The solution (automated sync script)
- The technical implementation
- The value delivered
If the sync fails:
- Check your token hasn't expired (Figma settings)
- Verify file is in team folder (not Drafts)
- Ensure
.envfile exists and has correct token - Run with
node sync-design-tokens.jsto see error details
Last Updated: 2026-01-06 Status: ✅ Working!