Last active
August 29, 2015 14:07
-
-
Save Undistraction/38c63daae90d397095ff 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.4.5) | |
// Compass (v1.0.1) | |
// ---- | |
// TEST | |
$debug:null; | |
@function compress($value) { | |
$top: nth($value, 1); | |
$right: nth($value, 2); | |
$bottom: nth($value, 3); | |
$left: nth($value, 4); | |
$debug: #{$top}#{$right}#{$bottom}#{$left} !global; | |
$result: null; | |
// All same | |
@if $top == $right and $right == $bottom and $bottom == $left { | |
$result: $top; | |
// top + bottom same | |
} @else if $top == $bottom { | |
@if $right == $left { | |
// left + right same | |
$result: #{$top} #{$right}; | |
} | |
}@else if $right == $left { | |
$result: #{$top} #{$right} #{$bottom}; | |
} @else { | |
$result: $value; | |
} | |
@return $result; | |
} | |
.all-different { | |
padding: compress(1px 2px 3px 4px); | |
} | |
.vertical-horizontal { | |
padding: compress(1px 2px 1px 2px); | |
} | |
.top-horizontal-bottom { | |
padding: compress(1px 2px 3px 2px); | |
} |
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
.all-different { | |
padding: 1px 2px 3px 4px; | |
} | |
.vertical-horizontal { | |
padding: 1px 2px; | |
} | |
.top-horizontal-bottom { | |
padding: 1px 2px 3px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment