Created
April 12, 2014 09:50
-
-
Save impressivewebs/10527600 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// 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); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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