Last active
December 16, 2015 05:59
-
-
Save ourmaninamsterdam/5388493 to your computer and use it in GitHub Desktop.
Lookup table-like mixin for retrieving data from a linked list. Ideal for including predefined font stacks and media queries, by name. Great way to avoid lengthy conditional statements when you require multiple outcomes from a mixin.
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
@function get-item-by-name( $name, $names-list, $items ){ | |
@return #{ nth( $items, index( $names-list, $name ) ) }; | |
} | |
$font-stack-ids: proxima-light, proxima-regular, proxima-semibold | |
$font-stacks: "'Proxima Nova Light', Tahoma, Arial, Helvetica, sans-serif", | |
"'Proxima Nova Regular', Tahoma, Arial, Helvetica, sans-serif", | |
"'Proxima Nova Semibold', Tahoma, Arial, Helvetica, sans-serif"; | |
@function font-stack( $name ){ | |
@return get-item-by-name( $name, $font-stack-ids, $font-stacks ); | |
} |
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
.main{ | |
font-family: font-stack(proxima-light); | |
float: none; | |
width: auto; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment