Skip to content

Sync Figma tokens and add theme/mode switcher to Storybook#32

Open
sjoerdbeentjes wants to merge 3 commits into
mainfrom
feat/sync-figma-tokens
Open

Sync Figma tokens and add theme/mode switcher to Storybook#32
sjoerdbeentjes wants to merge 3 commits into
mainfrom
feat/sync-figma-tokens

Conversation

@sjoerdbeentjes

Copy link
Copy Markdown
Collaborator

What

  • Adds scripts/sync-figma.ts — pulls Figma Variables API and writes DTCG JSON for all themes and modes. Run with pnpm sync:figma (needs FIGMA_TOKEN + FIGMA_FILE_ID in .env).
  • Migrates Style Dictionary config to TypeScript (packages/tokens/scripts/style-dictionary.config.ts), executed via jiti.
  • Style Dictionary now generates per-theme CSS diffs and a typed themes export in dist/index.js with full resolved token values per theme and mode.
  • Adds theme and mode toolbar pickers to both Storybooks, driven by the keys of the generated themes object. Switching frameworks preserves the active theme and mode via the globals= URL param.

Token files

The DTCG JSON files in packages/tokens/src/ are generated — edit sync-figma.ts or re-run pnpm sync:figma rather than editing them by hand.

Checklist

  • pnpm sync:figma writes JSON only, no CSS
  • pnpm build generates CSS + JS from the JSON
  • pnpm lint and pnpm format pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant