impressivewebs
4/12/2014 - 9:50 AM

Generated by SassMeister.com.

Generated by SassMeister.com.

Invalid CSS after "%width-25%": expected placeholder name, was ""
// ----
// Sass (v3.3.4)
// Compass (v1.0.0.alpha.18)
// ----

$cache-size: (
  'width'  : (),
  'height' : ()
);

@mixin size($width, $height: $width) {
  // Width
  $get-width: map-get($cache-size, 'width'); // 1
  @if not index($get-width, $width) { // 2
    $cache-size: map-merge($cache-size, ('width': append($get-width, $width))); // 3
    @at-root %width-#{$width} { // 4
      width: $width;
    }
  }

  // Height
  $get-height: map-get($cache-size, 'height'); // 1
  @if not index($get-height, $height) { // 2
    $cache-size: map-merge($cache-size, ('height': append($get-height, $height))); // 3
    @at-root %height-#{$height} { // 4
      height: $height;
    }
  }

  // Actually applying values
  @extend %width-#{$width};   // 5
  @extend %height-#{$height}; // 5
}

.element {
  @include size(25%, 5em);
}