Skip to content

Fix Sass theme map configuration and merge overrides via defaults() - #42849

Open
mdo wants to merge 1 commit into
v6-devfrom
mdo/fix-theme-colors-config
Open

Fix Sass theme map configuration and merge overrides via defaults()#42849
mdo wants to merge 1 commit into
v6-devfrom
mdo/fix-theme-colors-config

Conversation

@mdo

@mdo mdo commented Aug 18, 2026

Copy link
Copy Markdown
Member
  • Forward the theme module from scss/bootstrap.scss so $theme-colors and the theme layer maps are configurable via @use "bootstrap" with (...). Without this, configuration failed with a This variable was not declared with !default in the @used module error.
  • Convert $theme-colors, $theme-bgs, $theme-fgs, $theme-borders, and $util-opacity to the defaults() pattern, so overrides merge on top of the built-ins and a null value removes a key. The default build output is byte-identical.
  • Add a regression test (scss/tests/modules/_theme-colors.test.scss) that adds a custom theme through the entrypoint and asserts the built-ins survive.
  • Fix the Sass docs theme example, which used the isolated theme partial and an old text sub-key, and add a compile-time customization example to the Theme docs.

Fixes #42847

bootstrap.scss never forwarded the theme module, so configuring
`$theme-colors` through the entrypoint with `@use ... with (...)` failed
with a "not declared with !default" error. Forward the theme module to
expose the theme maps for configuration.

Also convert the theme maps to the defaults() pattern so overrides merge
on top of the built-ins instead of replacing the whole map, and let a
`null` value remove a key. The default build output is unchanged.

Add a regression test and update the Sass and Theme docs.

Fixes #42847
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

1 participant