Sha256: b38d8086b652bea1763ece49eb172462d7120bee69309a79f0857669b9c7df78

Contents?: true

Size: 1.41 KB

Versions: 5

Compression:

Stored size: 1.41 KB

Contents

// @category  utilities

// throw an error if archetype/util has not been registered
$a-blackhole: require-archetype-modules(archetype/util);

// simplify checking if a value is defined before outputting it to a property
// @mixin     if-set
// @param     $property {String} css property to define
// @param     $value {String} a valid css value for property
// @param     $ignore {List} a list of "falsy" values
// @usage
// =if-set(margin, $margin, $ignore: (5px 10px)); // will only output margin if it is not 5px or 10px
@mixin if-set($property, $value: false, $ignore: false) {
  @if($ignore == false) {
    $ignore: (0 0px);
  }
  @if($value != false and $value != null and not index(-archetype-list($ignore), $value)) {
    #{$property}: $value;
  }
}

// a mixin that prevents a given block from executing multiple times
// @mixin     do-once
// @param     $name {String} identifier to check/register
@mixin do-once($name) {
  @if do-once($name) {
    @content;
  }
}

// helper mixin for iterating over a meta object that contains multiple values
// @mixin     with-each-value
// @param     $values {*} the value or meta object of values to iterate over
// @content
@mixin with-each-value($values) {
  $values: if(has-multiple-values($values), map-get($values, values), append((), $values));
  @each $value in $values {
    $archetype-current-value: $value !global;
    @content;
    $archetype-current-value: null !global;
  }
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
archetype-1.0.0.alpha.5 stylesheets/archetype/util/_misc.scss
archetype-1.0.0.alpha.4 stylesheets/archetype/util/_misc.scss
archetype-1.0.0.alpha.3 stylesheets/archetype/util/_misc.scss
archetype-1.0.0.alpha.2 stylesheets/archetype/util/_misc.scss
archetype-1.0.0.alpha.1 stylesheets/archetype/util/_misc.scss