Purpose
Figma tokens names rarely match your runtime CSS variable names or Tailwind keys. A mapping step aligns the exported JSON tokens with the keys expected bytailwind.config.js and the Sitecopilot template engine.
Example token snippet (from design-tokens plugin)
Mapping file (example)
Create a simple mapping JSON that maps Figma token paths to Tailwind theme keys:How to apply the mapping
- After exporting
tokens.json, run a small script (node/python) that reads the mapping, transforms token names, and outputs a normalized token JSON consumed by thegenerate_tailwindconfigtool. - Regenerate
tailwind.config.jsand inspect the generator report for unresolved names. - Iterate: fix Figma variable names if necessary or update the mapping file.
Recommendations
- Use consistent, kebab-case or dot.notation naming in Figma to simplify mapping.
- Keep the mapping file in the theme repo (
/themes/<theme-name>/mapping.json) so designers & developers can collaborate. - Validate the final
tailwind.config.jsby runningnpx tailwindcss -i ./src/input.css -o ./dist/output.css --minifyin a local build.