Skip to content

Wire --spacer to $spacer in root tokens - #42927

Open
julien-deramond wants to merge 1 commit into
v6-devfrom
fix/root-tokens-spacer-css-var
Open

julien-deramond wants to merge 1 commit into
v6-devfrom
fix/root-tokens-spacer-css-var

Conversation

@julien-deramond

@julien-deramond julien-deramond commented Sep 13, 2026

Copy link
Copy Markdown
Member

Description

$root-tokens hardcodes --spacer: 1rem instead of interpolating #{$spacer}. This changes it to --spacer: #{$spacer}, matching how neighboring tokens in the same map (e.g. --border-width: #{$border-width}) already work.

Motivation & Context

$spacer is the base of the spacing scale and is meant to be overridable. Every --spacer-N token is generated from the $spacers map, which itself derives from $spacer, so overriding $spacer moves the whole scale. But --spacer itself stayed at 1rem regardless, because it was never wired to the variable it's named after. Anyone reading var(--spacer) directly after overriding $spacer would silently get a stale value.

Found while auditing v6-dev's custom-property/Sass-variable philosophy against julien-deramond/bootstrap-tokens#11.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would change existing functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Live previews

Related issues

🤖 Generated with Claude Code

$root-tokens hardcoded --spacer: 1rem instead of interpolating
$spacer. Every --spacer-N token derives from $spacer through the
$spacers map, so overriding $spacer moved the scale but left the
base token stuck at 1rem. Other tokens in the same map already
interpolate their Sass variable (e.g. --border-width), so this
brings --spacer in line with that convention.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
willbyers1

This comment was marked as spam.

This branch has not been deployed

No deployments
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.

2 participants