var.set()

The var.set() mixin defines the CSS variables based on the given $property.

@mixin set($property, $selector: (), $function: null) {
  @if type-of($property) == map {
    @include selector.nest-content($selector...) {
      @each $name, $variant in $property {
        @if type-of($variant) == map {
          @each $variant-name, $value in $variant {
            @each $name in if(list.separator($name) == comma, $name, ($name)) {
              @if type-of($value) == map {
                @each $value-name, $value in $value {
                  #{name(combine((method: join), $name, $variant-name, $value-name))}: if(
                    $function,
                    #{meta.call-arglist($function, $value)},
                    #{$value}
                  );
                }
              } @else {
                #{name(combine((method: join), $name, $variant-name))}: if(
                  $function,
                  #{meta.call-arglist($function, $value)},
                  #{$value}
                );
              }
            }
          }
        } @else {
          $value: $variant;
          @each $name in if(list.separator($name) == comma, $name, ($name)) {
            #{name($name)}: if(
              $function,
              #{meta.call-arglist($function, $value)},
              #{$value}
            );
          }
        }
      }
    }
  }
}

Parameters

$property

The property or properties of map type to set CSS variables.

$selector

Selector in which CSS variables are set.

$function

Function to call on property values of list type.

Examples

// Use.
@use 'angular-package/sass/var';

// Examples.

Last updated