Foundations

Token Pipeline

Scaffolded

Tokens are authored once in platform-agnostic W3C Design Tokens (DTCG) JSON, and transformed by Style Dictionary into every consumer format. CSS variables in the web app are one of many outputs — not the source of truth.

Architecture

The pipeline lives in the tokens/ folder at the repo root. Sources follow a three-tier model:

  • Core (primitives) — raw color scales, spacing ramp, type scale, radii, elevation, motion.
  • Semantic — purpose tokens (color.accent, surface.default) that reference core.
  • Brand — per-brand overrides of semantic tokens and print equivalents (CMYK, Pantone).

Outputs

PlatformOutputConsumer
Webtokens/build/web/tokens.cssImported by src/styles/theme.css
RN / JStokens/build/js/tokens.{js,d.ts}React Native components, NativeWind preset
iOStokens/build/ios/Tokens.swift + .jsonXcode project, SwiftUI
Androidtokens/build/android/{colors.xml, dimens.xml, Tokens.kt}Compose + classic Views
Windowstokens/build/windows/Tokens.xamlWinUI 3 ResourceDictionary
Printtokens/build/print/tokens-print.jsonInDesign / Illustrator swatch import
Motiontokens/build/motion/motion.jsonLottie / Reanimated preset

Authoring a token (W3C DTCG)

// tokens/src/core/color.json
{
  "color": {
    "navy": {
      "900": {
        "$value": "#194A8D",
        "$type": "color",
        "$description": "TpGROUP brand primary — CMYK 94/70/8/0, Pantone 2935 C"
      }
    }
  }
}

// tokens/src/semantic/semantic.json
{
  "semantic": {
    "color": {
      "accent": { "$value": "{color.navy.900}", "$type": "color" }
    }
  }
}

Build

# From the repo root:
pnpm --filter @tpisent/tokens install
pnpm --filter @tpisent/tokens build       # all platforms
pnpm --filter @tpisent/tokens build:web   # CSS only (fast dev)
pnpm --filter @tpisent/tokens build:ios   # Swift + JSON
# ... etc