Created
September 22, 2015 23:30
-
-
Save blackfalcon/92e294981fd60f285f7e to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains 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
// ---- | |
// libsass (v3.2.5) | |
// ---- | |
// Global variables | |
$body-type-size: xxsmall 8px, xsmall 10px, small 12px, medium 14px, large 16px, xlarge 18px, xxlarge 20px !default; | |
$title-type-size: xsmall 12px, small 14px, medium 16px, large 18px, xlarge 20px, xxlarge 24px, xxxlarge 28px, xxxxlarge 32px, xxxxxlarge 36px !default; | |
// Utility functions | |
// The following functions do the exact same thing, only call in a different variable? | |
@function body-type-size($size: medium) { | |
@each $value in $body-type-size { | |
@if nth($value, 1) == $size { | |
@return nth($value, 2); | |
} | |
} | |
} | |
@function title-type-size($size: medium) { | |
@each $value in $title-type-size { | |
@if nth($value, 1) == $size { | |
@return nth($value, 2); | |
} | |
} | |
} | |
// More universal function that will go in and get the value from any matched key | |
@function match-get($list, $key) { | |
@each $item in $list { | |
$index: index($item, $key); | |
@if $index { | |
$return: if($index == 1, 2, $index); | |
@return nth($item, $return); | |
} | |
} | |
@warn "'#{$key}' match was not found in provided list, please double check the argument provided."; | |
@return null; | |
} | |
// Selector that uses one of the utility functions | |
block { | |
font-size: title-type-size(medium); | |
} | |
// Selector that uses the univeral function | |
block { | |
font-size: match-get($title-type-size, medium); | |
} | |
This file contains 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
block { | |
font-size: 16px; | |
} | |
block { | |
font-size: 16px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment