Feat: Alias Fallbacks
See original GitHub issueLooked through the docs, examples, and issues, but not seeing any feature for defining fallback values when aliases do not resolve. For example, in a multi-brand system, I would like to have global defaults for all possible brand tokens. Then a particular brand could override just the tokens needed.
Global:
{
"color": {
"error": {
"value": "{color.brand.error.value || 'red'}"
},
"success": {
"value": "{color.brand.error.success || 'green'}"
}
}
}
Brand One:
{
"color": {
"brand": {
"success": {
"value": "blue"
}
}
}
}
This would alleviate the need for each brand to define all tokens, and instead define just the overrides. The syntax could also use a reserved key name like default
(or DEFAULT
, or VALUE
) instead of an expression:
Global:
{
"color": {
"error": {
"value": "{color.brand.error.value}",
"default": "red"
},
"success": {
"value": "{color.brand.error.success}",
"default": "green"
}
}
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:7 (7 by maintainers)
Top Results From Across the Web
resolve.fallback and resolve.alias do not work with `node:` prefix
Bug report resolve.fallback and resolve.alias do not work with node: prefix What is the current ... feat: add node: prefixed modules #12693.
Read more >NetSuite Applications Suite - Column.alias - Oracle Help Center
URL Component Aliases ... Adding Items to Web Store Categories · Featuring Items ... Fallback and Storage Limits for Mobile Apps · Working...
Read more >A tip to set fallback fonts in gvim on *nix (courtesy of farrioth at ...
Setting a fallback font to use in GTK+ gvim for characters which are not available in your preferred font. In .fonts.conf: <alias> <!...
Read more >neoclide/coc.nvim - Gitter
I'm having trouble getting coc to resolve file paths defined by webpack resolve.alias configuration. Could this be due to the fact that the...
Read more >Which systems have 'pager' shortcut/alias?
On a Debian system, one can type pager in order to use whatever pager program happens to be default/available. By default, less is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I wrote up a quick example as well that hopefully helps…
https://github.com/dbanksdesign/style-dictionary-multi-brand-with-defaults
Great question. I think that this can be done using the config.include parameter for your global (default) styles and the config.source parameter for your brand (overwrite) styles.
https://amzn.github.io/style-dictionary/#/config
Let me know if this helps, or if it doesn’t fit your use case.