Module Configuration and Theme Overrides
Sass modules can expose configurable variables by declaring defaults with !default. Consumers can configure those variables when loading a module with @use and a with clause.
This approach is useful for white-label applications, component libraries, and design systems that allow a consumer to override approved brand tokens.
Module configuration must occur when the module is first loaded. A module cannot be independently configured multiple times with conflicting configurations within the same compilation context.
Keep configurable values focused on stable customization points. Exposing every internal variable makes the module's public API difficult to maintain.
// themes/_theme.scss
$brand-color: #5b5bd6 !default;
$surface-color: #ffffff !default;
$text-color: #222222 !default;
.button {
background: $brand-color;
color: white;
}
// customer.scss
@use "themes/theme" with (
$brand-color: #00695c,
$surface-color: #f5f5f5,
$text-color: #202020
);Which Sass feature allows consumers to configure eligible module variables when loading a module?