Skip to content

feat(Design Token): Add in ability to declare fallbacks #9

Description

@jhechtf

Description

While working on the repo the other day I realized that currently if we have a value that is not declared inside the base tokens, but is declared in the MediaQuery (either purposefully or mistakenly), that value results in an Unresolved Reference, e.g.

// design.tokens.ts
{
  tokens: {
    rr: '!not.it',
  },
  variants: {
    'max-width: 300px': {
      not: {
        it: '#fcb'
      }
    }
  }
}

While I don't exactly know why we would want this yet, being able to do something like

// design.tokens.ts
{
  tokens: {
    rr: '!not.it(#0fb)',
  },
  variants: {
    'max-width: 300px': {
      not: {
        it: '#fcb'
      }
    }
  }
}

This would keep the 'unresolved reference` from occurring since a fallback was given, and would cause the CSS output to render as

:root {
  rr: var(--not-it, #0fb);
}
/* media query stuff here */

Metadata

Metadata

Assignees

Labels

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions