Pipeline

The token pipeline is active for foundation CSS variables. It proves that tokens build from source and that the production stylesheet consumes the generated output.

Source and output#

ItemPath or commandRole
Source tokenstokens/core.tokens.jsonHuman-reviewed DTCG $value and $type token source
Build configstyle-dictionary.config.mjsStyle Dictionary configuration and custom name transform
Generated CSSassets/css/generated/tokens.cssGenerated custom properties bundled before site CSS
Theme collectionstokens/themes/{light,dark}.tokens.jsonSelector-scoped semantic colour overrides
Generated theme CSSassets/css/generated/themes.cssLight and dark collection output
Generated datadata/brand/tokens.ymlGenerated Hugo data for token reference tables
Tailwind bridgetailwind.tokens.cjsGenerated token-backed Tailwind theme values
Diagram exportstokens/exports/diagram.json, static/tokens/diagram.jsonResolved values for repository and published diagram use
Build commandnpm run tokens:buildRebuilds generated token CSS
Data commandnpm run tokens:dataRebuilds generated Hugo token data
Tailwind commandnpm run tokens:tailwindRebuilds the generated Tailwind theme bridge
Theme commandnpm run tokens:themesRebuilds selector-scoped theme collection CSS
Diagram commandnpm run tokens:diagramsRebuilds diagram token exports
Test commandnpm run tokens:testValidates alias resolution and colour contrast
Update commandnpm run tokens:updateRebuilds and verifies all generated token output
Check commandnpm run tokens:checkVerifies generated output and CSS references

Hugo bundles the generated CSS before the processed site stylesheet, so assets/css/site.css can consume variables such as --color-accent, --font-serif, and --space-s-m without owning their values. outputReferences: true keeps the active colour alias chain visible in generated CSS: semantic interface variables resolve through their --color-palette-* primitives. The docs render category tables from data/brand/tokens.yml, which is generated from the same token metadata.

Use Token architecture for the source boundary, theme selection, consumer model, and complete change routine.

Build rules#

  • npm run tokens:build should finish without warnings.
  • npm run tokens:update should rebuild core CSS, data, Tailwind values, theme CSS, and diagram exports before a token change is committed.
  • npm run tokens:check should pass without mutating the working tree.
  • Generated output should be committed only when it is deterministic.
  • Token source changes and generated output should land in the same commit.
  • visibility: internal is for supporting implementation primitives. It remains available for generated CSS aliases but does not appear in the public token table or Tailwind bridge.
  • CSS should not reference a generated token that is missing from the output.
  • Site CSS must not contain raw hexadecimal colour literals. Add a semantic token instead, then consume its generated CSS variable.
  • Site CSS must not use an ungoverned Tailwind colour-palette utility. The approved Tailwind colour utilities resolve through generated token variables.
  • Site CSS must not use raw arbitrary font-weight, font-size or tracking utilities. Add or reuse a typography token and its token-backed utility instead.
  • Warnings are treated as work, following ADR 0004’s dependency and warning policy.

Inspiration#

Red Hat Design System uses tokens as a productized design-system library, with installation guidance, generated token categories, and developer usage notes. That is useful inspiration, but this site keeps a smaller pipeline: source tokens, generated CSS, generated Hugo data, and category pages rendered from that data.