Skip to content

Consider including font shorthand for CSS custom properties #41

@jonathantneal

Description

@jonathantneal

In the current CSS export of tokens, providing font styles to an element can feel lengthy and prone to error.

.hypothetical-example-based-on-applying-font-body-1 {
  font-family: var(--font-body-1-font-family);
  font-size: var(--font-body-1-font-size);
  font-weight: var(--font-body-1-font-weight);
  letter-spacing: var(--font-body-1-letter-spacing);
  line-height: var(--font-body-1-line-height);
}

The verbosity can be reduced from 5 lines to 2 lines by providing a token for the font property.

.hypothetical-example-based-on-applying-font-body-1 {
  font: var(--font-body-1);
  letter-spacing: var(--font-body-1-letter-spacing);
}

Such a token would look something like this:

.hypothetical-root {
  --font-body-1: 400 1rem/var(--font-body-1-line-height) var(--font-body-1-font-family);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions