config.js
Style Dictionary configuration generator for Chassis Tokens
On this page
config.js
This script generates Style Dictionary configuration objects for each build task. It determines the correct settings for each platform (web, iOS, Android, etc.) and defines how and where output files are generated.
Key Responsibilities
- Generates configuration for each brand/app/platform/theme/screen combination
- Defines platform-specific transforms, build paths, and file formats
- Supports custom preprocessors and file headers
- Handles platform-specific options (e.g., rem/px/vw for web, Swift for iOS, XML for Android)
Example Usage
import config from './config.js'
const sdConfig = config({
brand: 'chassis',
app: 'docs',
platform: 'web',
theme: 'light',
screen: 'large'
})
Platform Settings
- Web: SCSS variables, rem/px/vw units, custom transforms
- iOS: Swift class output, iOS-specific transforms
- Android: XML resource output, Android-specific transforms
File Generation
The generateFiles function (see source) determines which files are created for each platform and how they are formatted.