2-mixins-and-functions edit

function-font  edit

outputs font using font map

Font function
Pulls font and font weight from variable map
usage: font-family: font(text-sans);
usage: font-weight: font(sans-weight, demi);
Go to font variables and map

Copy
Edit
<!-- components/2-mixins-and-functions/function-font.php --> <p> <strong>Font function</strong><br> Pulls font and font weight from variable map <br> usage: <code>font-family: font(text-sans);</code> <br> usage: <code>font-weight: font(sans-weight, demi);</code><br> <a href="../wm/atomic-core/?cat=3-variables#wm-font-families">Go to font variables and map</a> </p>
Copy
Copy
Edit
/* scss/2-mixins-and-functions/_function-font.scss */ //* ------------ FONT FUNCTION // variable prefixes for CSS4 output $font-prefix: --font-; // retrieve font from map with Sass ie. // font(text-sans); // font(text-sans-weight, demi) @function font($font-name, $font-variant: null) { // if we need to return the font value //@if $true-val == true { // if font variant is specified @if ($font-variant != null) { // map inception, need two deep @return map-get(map-get($fonts, $font-name), $font-variant); } @else { // single-level font, one deep @return map-get($fonts, $font-name); } }