Fix Sass theme map configuration and merge overrides via defaults() - #42849
Open
mdo wants to merge 1 commit into
Open
Fix Sass theme map configuration and merge overrides via defaults()#42849mdo wants to merge 1 commit into
mdo wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
thememodule fromscss/bootstrap.scssso$theme-colorsand the theme layer maps are configurable via@use "bootstrap" with (...). Without this, configuration failed with aThis variable was not declared with !default in the @used moduleerror.$theme-colors,$theme-bgs,$theme-fgs,$theme-borders, and$util-opacityto thedefaults()pattern, so overrides merge on top of the built-ins and anullvalue removes a key. The default build output is byte-identical.scss/tests/modules/_theme-colors.test.scss) that adds a custom theme through the entrypoint and asserts the built-ins survive.themepartial and an oldtextsub-key, and add a compile-time customization example to the Theme docs.Fixes #42847