Understand the Style Dictionary build pipeline
mainStyle Dictionary operates through a multi-stage pipeline that transforms raw design tokens into platform-specific code. The process follows these nine steps:
- Parse the config: Reads your configuration file to determine the build instructions.
- Find all token files: Uses
includeandsourceglobs from your config to locate token files. - Parse token files: Uses built-in or custom parsers to convert files into JavaScript objects.
- Deep merge token files: Combines all parsed objects into a single, complete dictionary.
- Run preprocessors: Executes custom preprocessors on the merged dictionary (either globally or at the platform level).
- Transform the tokens: Traverses the dictionary and applies transforms to any token containing a
valuekey. - Resolve aliases: Replaces references (e.g.,
"{size.font.base}") with their transformed values. - Format the tokens: Uses formats to turn the resolved dictionary into specific file outputs.
- Run actions: Executes actions after files are generated (e.g., for asset copying or image generation).