Design practice
Build a Token Pipeline
Set up a W3C-compliant token system with Style Dictionary and CSS custom properties
01 / Prepare
What you’ll
work on.
Build a working design token pipeline from JSON source files to CSS custom properties output, following the W3C Design Token Format and using Style Dictionary v4. You will define reference, semantic, and component tokens for a small design system.
Before you begin
- Node.js installed
- Basic command-line familiarity
- Understanding of CSS custom properties
- Understanding of reference, semantic, and component token tiers
02 / Practice
The work,
step by step.
Work through these 4 parts at your own pace. Keep your notes and work together so you can review them when you finish.
Token Source Files
90 min
Create the project structure with reference/, semantic/, and component/ directories under a tokens/ folder
tokens/ ├── reference/ │ ├── color.json │ ├── typography.json │ └── spacing.json ├── semantic/ │ ├── color.json │ ├── typography.json │ └── spacing.json └── component/ └── button.jsonDefine reference tokens — Raw values: a color palette (8–10 colors with tint scales), a type scale (6–8 sizes), a spacing scale (4px base, 8 steps)
Define semantic tokens — Intent-based aliases: color.surface.primary, color.text.primary, color.interactive.primary, typography.heading.lg, spacing.gap.md
Define component tokens — Button-scoped: button.primary.background, button.primary.text, button.padding.horizontal
Style Dictionary Configuration
60 min
Install Style Dictionary
npm install style-dictionary@4Write the config — Register source files, define CSS custom properties output
Build — Run the pipeline, verify output CSS file
Inspect the output — Confirm tokens resolve through the chain (component → semantic → reference)
Multi-Theme Support
60 min
Create a dark theme override — New semantic token file that remaps surface and text colors
Configure two build targets — :root (light) and [data-theme="dark"] (dark)
Build both themes — Verify the same component tokens resolve to different values per theme
Documentation
30 min
Write a brief README — What the tokens are, how to build, how to add a new token
Document naming conventions — tier-category-variant-state pattern
03 / Review
Look at what
you’ve made.
Gather your deliverables, then use the criteria to find what worked and what you would change. They also give a peer something specific to respond to.
What to bring together
- Token source files (JSON, W3C format)
- Style Dictionary config
- Generated CSS output (light + dark themes)
- README with naming conventions
How to assess your work
- Token structure
- Clean three-tier architecture with proper aliasing
- Naming
- Consistent, predictable naming that communicates intent
- Theming
- Dark theme works through token remapping, not hardcoded overrides
- Build pipeline
- Style Dictionary config is clean and extensible