Style Dictionary is a powerful build system for creating and managing design tokens across multiple platforms and technologies. It allows developers and designers to define styles once using a single source of truth, typically JSON-based design tokens, and then automatically generate platform-specific assets such as CSS variables, Sass maps, iOS `.h`/`.m` files, Android XML resources, and JavaScript objects. The current stable version is 5.4.0, with frequent patch and minor releases, often adding support for the latest Design Token Community Group (DTCG) specification drafts. Its key differentiator is its highly configurable transformation and formatting pipeline, enabling extensive customization for diverse output requirements across web, iOS, and Android ecosystems. It's designed to streamline design system implementation by ensuring consistency and reducing manual synchronization efforts, thereby solving errors, roadblocks, and workflow inefficiencies.
npm install style-dictionaryVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to programmatically define design tokens, configure Style Dictionary, and build platform-specific output files like CSS variables and ES Modules JavaScript. It highlights the asynchronous nature of `extend` and `build` methods introduced in v4.
Refer to the official v4 migration guide for a comprehensive list of changes. For JavaScript files, convert to ESM or use dynamic imports. Update API calls to `await StyleDictionary.extend(...)` and `await sd.buildAllPlatforms()`. Consider using `npx codemod styledictionary/4/migration-recipe` for automated updates.
Ensure your development environment and CI/CD pipelines use Node.js version 22.0.0 or higher. Update your `package.json` engines field accordingly.
Ensure token references point directly to design token values and adhere to the DTCG-aligned syntax without custom separators or the `.value` suffix. Review your token definitions for strictness.
Review the DTCG specification and Style Dictionary release notes for new token structures. Update your token definitions to use the structured formats where appropriate to benefit from new transforms and improved interoperability. Verify custom transforms handle both legacy string and new object formats if mixed usage is expected.
Upgrade to Style Dictionary v5.0.4 or newer to resolve the excessive token collision warnings. Alternatively, you can configure logging to disable warnings if they are not critical (`log.warnings: 'disabled'`) in your configuration.
Upgrade to the latest patch release of Style Dictionary (v5.4.0 or newer) to ensure these specific bugs are resolved. Verify your token data doesn't contain unexpected `NaN` values for `size` tokens or unusual `fontName` patterns.
Upgrade your Node.js installation to version 22.0.0 or newer. Use a tool like `nvm` to manage Node.js versions: `nvm install 22 && nvm use 22`.
Ensure your `package.json` contains `"type": "module"` if you are using `.js` files with `import`/`export`. Alternatively, rename your build script to `build.mjs` or dynamically import Style Dictionary: `const StyleDictionary = (await import('style-dictionary')).default;`.Review your token files and configuration. Ensure all references (`{...}`) point to valid, defined design token paths. Check that no filters are inadvertently excluding referenced tokens. Pay close attention to nested namespaces, especially those with special characters or if exporting from tools like Figma Tokens Studio.Since v4, `StyleDictionary` is a class. You should use `await StyleDictionary.extend(config)` or `const sd = new StyleDictionary(config); await sd.init();` to create an instance. Ensure `await` is used as `extend` is now asynchronous.
No dependency data recorded yet.