Skip to content

Finish moving Sass variables to CSS custom property tokens#42701

Merged
mdo merged 6 commits into
v6-devfrom
v6-sass-vars-to-tokens
Jul 17, 2026
Merged

Finish moving Sass variables to CSS custom property tokens#42701
mdo merged 6 commits into
v6-devfrom
v6-sass-vars-to-tokens

Conversation

@mdo

@mdo mdo commented Jul 17, 2026

Copy link
Copy Markdown
Member

Continues the tokens migration by removing the last few Sass variables that only ever fed a single CSS custom property, or that duplicated values already available as tokens elsewhere.

  • Consolidate the individual $font-weight-* variables into a $font-weights map (mirrors $font-sizes) so the --font-weight-* tokens and fw-* utilities are generated from one source.
  • Replace $line-height-base/$line-height-sm/$line-height-lg with the --line-height-* tokens already generated from $font-sizes.
  • Remove $headings-color, hardcoding --heading-color: inherit directly.
  • Remove $link-decoration/$link-underline-offset, hardcoding their values directly in $root-tokens.
  • Move $transition-fade/$transition-collapse/$transition-collapse-width into $fade-tokens/$collapse-tokens in _transitions.scss so they're runtime-customizable CSS variables like other component tokens; $transition-base moves next to the mixin that uses it.

Also fixes two breakages introduced by the in-progress version of this work: an undefined $link-underline-offset reference left in _root.scss, and a typo ($transitions-tokens instead of $fade-tokens) in the new _transitions.scss that broke the full build.

mdo added 6 commits July 16, 2026 20:42
Individual $font-weight-lighter/light/normal/medium/semibold/bold/bolder
variables made it easy to forget one when adding a new weight and kept
the values duplicated across _config.scss, _root.scss, and the
utilities API. Move them into a single $font-weights map so --font-weight-*
tokens and the fw-* utilities are generated from one source, matching
the pattern already used for $font-sizes.
$line-height-base/sm/lg duplicated values already exposed as
--line-height-* tokens (generated from $font-sizes). Point the
line-height utilities and --body-line-height at the CSS variables
instead of the Sass variables so there's one source of truth and
runtime overrides of --line-height-* also affect the utility classes.
It was the last Sass variable left in the heading/type system after
the rest moved to CSS custom properties, and it only ever had one
value (inherit). Hardcode --heading-color: inherit directly in
$root-tokens instead so headings customization is fully CSS-variable
driven, matching paragraphs, lists, and legend.
Both had a single fixed value and existed only to be interpolated into
--link-decoration and --link-underline-offset once, in $root-tokens.
Hardcode the values there directly instead, simplify the list-group
item's text-decoration to plain `none` (it no longer needs to branch
on $link-decoration), and drop the stray commented-out
$enable-negative-margins default and leftover dead comments in Reboot.
$transition-fade and $transition-collapse/$transition-collapse-width
lived in _config.scss like other component tokens used to before the
tokens migration, but .fade and .collapsing never picked up the
--fade-*/--collapse-* token treatment. Give them their own
$fade-tokens and $collapse-tokens (via defaults()) in _transitions.scss
so --transition-fade, --transition-collapse, and
--transition-collapse-width are runtime-customizable CSS variables
like the rest of the component tokens. $transition-base moves into
mixins/_transition.scss, next to the mixin that uses it as a fallback.
@mdo
mdo requested a review from a team as a code owner July 17, 2026 03:49
@mdo mdo added this to v6.0.0 Jul 17, 2026
@github-project-automation github-project-automation Bot moved this to Inbox in v6.0.0 Jul 17, 2026
@mdo
mdo merged commit 4ceb246 into v6-dev Jul 17, 2026
12 checks passed
@mdo
mdo deleted the v6-sass-vars-to-tokens branch July 17, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

1 participant