-
Notifications
You must be signed in to change notification settings - Fork 580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to fix Some token references (2) could not be found. #1458
Comments
I also am having a similar issue using the multi-brand-multi-platform example but I get the "Some token references could not be found error" when the names of my brands match the directory names or when I provide a custom path in the source in the getStyleDictionaryConfig source property. If my directories are named differently than what I use for brands in the build.js and remove the build.js
tokens/brands/brand-1/background.json5
tokens/brands/brand-2/background.json5
package.json
tokens/primitives/breakpoint.json5
npm version: 10.9.2 |
This is expected because you're putting your "custom theme a" and also "custom theme b" in the source property for both Style Dictionary instances. The former is referring to brand A and the latter is referring to brand B but the Style Dictionary instance only has one or the other available, one at a time. Generally speaking, your theme-specific tokensets will contain the exact same token definitions but with different values (depending on the theme). In your example, your theme-specific tokensets contain different token definitions. This won't work when your non-theme-specific sets are referring to tokens in your theme-specific sets and expecting only to refer to a different token value (but the same token definition) when the theme changes. |
Problem
When building Style Dictionary tokens for multiple brands, and themes the build process fails with a reference error:
stackblitz link
amazon-style-dictionary-v1
The issue occurs when custom themes try to reference brand-specific tokens.
Steps to Reproduce
Expected Behavior
Style Dictionary should resolve all token references and successfully complete the build process.
Actual Behavior
Build fails with reference errors. Two token references cannot be found.
Relevant Code
Issue appears to be in the token references:
In customThemes/a/theme-a.json:
In customThemes/a/theme-b.json:
Possible Causes
style-dictionary/tokens/brand-a/base.json
style-dictionary/tokens/brand-b/base.json
customThemes/a/theme-a.json
customThemes/a/theme-b.json
build.js
Environment
Style Dictionary (version: 4.3.3)
The text was updated successfully, but these errors were encountered: