question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feat: Alias Fallbacks

See original GitHub issue

Looked 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:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

7reactions
dbanksdesigncommented, Feb 27, 2021

I wrote up a quick example as well that hopefully helps…

https://github.com/dbanksdesign/style-dictionary-multi-brand-with-defaults

4reactions
chazzmoneycommented, Feb 25, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found