Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
feat(theme): allow to specify varname prefix in custom-properties con…
Browse files Browse the repository at this point in the history
…figuration

PiperOrigin-RevId: 492403377
  • Loading branch information
material-web-copybara authored and copybara-github committed Dec 2, 2022
1 parent 68aaed9 commit f0a0bbc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/mdc-theme/_custom-properties.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ $_config: (
emit-custom-properties: true,
emit-fallback-values: true,
emit-fallback-vars: true,
varname-prefix: 'mdc',
);

/// Configure options for custom properties. The configuration will be applied
Expand All @@ -55,6 +56,7 @@ $_config: (
/// fallback values.
/// @param {Bool} $emit-fallback-vars [true] - Enable or disable emission of
/// fallback `var()` values.
/// @param {String} $varname-prefix ['mdc'] - Global prefix for all custom properties.
@mixin configure($config...) {
@if not meta.content-exists() {
@error 'content is required for configure()';
Expand Down Expand Up @@ -124,9 +126,6 @@ $_config: (
@return (varname: $varname, fallback: $fallback);
}

/// Global prefix for all custom properties.
$_varname-prefix: 'mdc';

/// Create a custom property variable name with the global prefix.
///
/// @example - scss
Expand All @@ -135,7 +134,8 @@ $_varname-prefix: 'mdc';
/// @param {String} $name - The name of the custom property.
/// @return {String} The full CSS custom property variable name.
@function create-varname($name) {
@return --#{$_varname-prefix}-#{$name};
$varname-prefix: map.get($_config, 'varname-prefix');
@return --#{$varname-prefix}-#{$name};
}

/// Returns the custom property variable name of a custom property Map.
Expand Down

0 comments on commit f0a0bbc

Please sign in to comment.