Sha256: 738c684cb27f8eff4dd93a35b5870c8ce456ca3be7d53eaa18d964cebd13322d

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

// Utility generator
// Used to generate utilities & print utilities
@mixin generate-utility($utility, $infix) {
  $values: map-get($utility, values);

  // If the values are a list or string, convert it into a map
  @if type-of($values) == "string" or type-of(nth($values, 1)) != "list" {
    $values: zip($values, $values);
  }

  @each $key, $value in $values {
    $properties: map-get($utility, property);

    // Multiple properties are possible, for example with vertical or horizontal margins or paddings
    @if type-of($properties) == "string" {
      $properties: append((), $properties);
    }

    // Use custom class if present
    $property-class: map-get($utility, class);
    $property-class: if($property-class, $property-class, nth($properties, 1));

    // Don't prefix if value key is null (eg. with shadow class)
    $property-class-modifier: if($key, "-" + $key, "");

    .#{$property-class + $infix + $property-class-modifier} {
      @each $property in $properties {
        // stylelint-disable-next-line declaration-no-important
        #{$property}: $value !important;
      }
    }
  }
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
another-theme-1.0.4 _sass/another/mixins/_utilities.scss
another-theme-1.0.3 _sass/another/mixins/_utilities.scss
another-theme-1.0.2 _sass/another/mixins/_utilities.scss
another-theme-1.0.1 _sass/another/mixins/_utilities.scss
another-theme-1.0.0 _sass/another/mixins/_utilities.scss