Skip to content

Instantly share code, notes, and snippets.

@impressivewebs
Created April 12, 2014 09:50
Show Gist options
  • Save impressivewebs/10527600 to your computer and use it in GitHub Desktop.
Save impressivewebs/10527600 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// 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);
}
Invalid CSS after "%width-25%": expected placeholder name, was ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment