Import tokens
Bring existing tokens or product CSS in as a reviewed proposal, then apply it.
On this page
An import never changes your files directly. sketchbook tokens import writes a proposal to generated/import/<name>.proposal.json, mapped onto the semantic interface. You review it, then import apply writes it to brand.config.json and the semantic files. Sources are DTCG or Tokens Studio JSON (a file or a folder of sets) and CSS custom properties.
-
Create the proposal.
--fromisdtcgorcss; by default it follows the file type.--namenames the proposal.sketchbook tokens import tokens.json --from dtcg sketchbook tokens import theme.css --from css --name brand -
Map the names. The
token-mapperbrief reads the proposal andspec/tokens/interface.json, and reports each interface token asmatch,candidatesormissing. It writes onlygenerated/import/<name>.mapping.json. -
Review. Go through unmapped tokens, candidates, new roles and contrast failures, one at a time.
-
Preview the apply.
sketchbook tokens import apply generated/import/brand.proposal.json --dry-run -
Apply.
--onlylimits it tosemantic,foundationormappedentries.--min-confidenceskips weaker entries.sketchbook tokens import apply generated/import/brand.proposal.json --min-confidence 0.6 -
Close out.
sketchbook tokens diff sketchbook check
Note
In Claude Code,
/import-tokens <file>runs these steps. It infers--fromfrom the content and applies only on your yes.
Start from an existing product
With a product but no token file, audit-css clusters its colors, font sizes, spacing, radii and shadows into generated/import/codebase.proposal.json. Quote globs.
sketchbook audit-css ../product/src --dry-run
sketchbook audit-css "app/**/*.css"
Review the proposal with /foundations import, or start with sketchbook init --start from-codebase --from "<path|glob>".
Next steps
- Change a foundation: refine imported values with presets.
- Foundations CLI: every option of
tokensandaudit-css.