Skip to content

Instantly share code, notes, and snippets.

@blackfalcon
Created September 22, 2015 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blackfalcon/92e294981fd60f285f7e to your computer and use it in GitHub Desktop.
Save blackfalcon/92e294981fd60f285f7e to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// 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);
}
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