Created
October 7, 2014 07:54
-
-
Save Undistraction/28a912e0779ae34837e1 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.4) | |
// Compass (v1.0.1) | |
// ---- | |
// LIB | |
// ------------------------------------------------------------------------- | |
// 1. Check if the value maps to one of our keywords and if so, swap out the value | |
@function core-parse-value-filter($value){ | |
@return $value; | |
} | |
// 2. Check if the resolved value is unitless. If so multiply the value by the rhythm | |
// unit we are using | |
@function core-lookup-value-filter($value){ | |
@return $value; | |
} | |
@mixin padding-top($value) { | |
@if core-should-parse-value($value) { | |
$value: core-parse-value-filter($value); | |
$value: core-lookup-value-filter($value); | |
} | |
padding-top: #{$value}; | |
} | |
// CORE | |
// ------------------------------------------------------------------------- | |
$core-valid-unitless-values: "auto" "initial" "inherit" 0; | |
@function core-should-parse-value($value){ | |
@return core-is-valid-unitless($value) or core-is-number_with_unit($value); | |
} | |
@function core-is-valid-unitless($value) { | |
@return not not index($core-valid-unitless-values, $value); | |
} | |
@function core-is-number_with_unit($value) { | |
@return not (type-of($value) == "number" and not unitless($value)); | |
} | |
.Default { | |
@include padding-top(10px); | |
} | |
// APP | |
// ------------------------------------------------------------------------- | |
$rhythm-units-map: ( | |
single: 1, | |
double: 2, | |
triple: 3, | |
quadruple: 4, | |
half: 0.5, | |
third: 0.33333333333, | |
quarter: 0.25 | |
); | |
$rhythm-map: ( | |
vertical: 10px, | |
horizontal: 14px | |
); | |
@function core-parse-value-filter($key){ | |
@if map-has-key($rhythm-units-map, $key) { | |
@return map-get($rhythm-units-map, $key); | |
} @else { | |
@error 'Unsupported key'; | |
} | |
} | |
@function core-lookup-value-filter($value){ | |
@return $value; | |
} | |
.Lookup { | |
@include padding-top(single); | |
} | |
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
.Default { | |
padding-top: 10px; | |
} | |
.Lookup { | |
padding-top: 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment