Skip to main content Skip to docs navigation
Added in v1.0.0 View on GitHub

Welcome to Chassis Tokens

Introduction to migrating design tokens to Chassis

Overview

Chassis Tokens provides a comprehensive system for transforming design tokens into platform-ready assets. This introduction covers the core concepts and the token transformation process.

Token Transformation Process

Chassis Tokens uses a robust build system to transform design tokens (from JSON or Figma variables) into platform-ready assets (SCSS, CSS, iOS, Android, etc.). The process is highly configurable, supporting multiple brands, themes, apps, and screens.

Source of Truth

  • Tokens are defined in JSON files under the tokens/ directory.
  • Each token set can represent a brand, theme, app, or screen size.
  • $themes.json describes all available theme permutations.

Build Orchestration

pnpm tokens --brand=chassis --theme=light --app=docs --screen=large

Task Generation

  • The build script generates a list of transformation tasks for all combinations of:
    • Brand (e.g., chassis)
    • Theme (e.g., light, dark)
    • App (e.g., docs)
    • Screen (e.g., small, large)
  • Each task defines:
    • The source token files
    • The output platform (web, iOS, Android, etc.)
    • The output file(s) and format(s)

Transformation Steps

  1. Preprocessing Custom preprocessors (e.g., cx/global) can modify tokens before transformation.
  2. Filtering Only relevant tokens for the current brand/theme/app/screen are included.
  3. Transforms Custom and standard transforms (e.g., color conversion, size scaling) are applied.
  4. Formatting Output files are generated in the required format (SCSS variables, CSS custom properties, Swift, XML, etc.).
  5. File Headers Each output file includes a standard header with version and license info.

Output

  • Web: SCSS/CSS files in icons/package/ and build/
  • iOS: Swift files
  • Android: XML files
  • Other platforms as configured

Test title

as dkf;alsdf asldfasdf asdf as

Test 2 title

sdjf alskjdfhl askjdflas

Test 3 title

sdjf alskjdfhl askjdflas

Customization

  • Add new brands/themes/apps/screens by editing package.json and tokens/$themes.json.
  • Add new transforms/filters/formats in build/tokens/transforms.js, filters.js, and formats.js.
  • Configure output in build/tokens/config.js.

Example: Adding a New Theme

  1. Add the theme to package.json under chassis.build.themes.
  2. Add the theme permutation to tokens/$themes.json.
  3. Add or update token files in tokens/.
  4. Run the build:
    pnpm tokens --theme=newtheme
    

CLI Usage

  • Build all tokens: pnpm tokens
  • Build for a specific brand/theme/app/screen: pnpm tokens --brand=chassis --theme=dark --app=docs --screen=large

Extending the System

  • Add new output platforms by updating config.js and providing new formatters.
  • Integrate with Figma/Token Studio by updating token import scripts.

Troubleshooting

  • Deprecation warnings: See the build output and update your tokens or config as needed.
  • Custom transforms/filters: Ensure they are registered in the build script.

References

For more details, see the source code in build/tokens/ and the README in the project root.

Hello, world!

html
<p>Hello, world!</p>

Test: overview

Looking for more information?
Visit the Chassis CSS documentation site for comprehensive guidelines and details on using the CSS package.

Lorem