Created
April 24, 2022 08:01
-
-
Save ronaldpoi/d7f5e1caaafbbee948b78e296aa7c093 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
$type-stack: ( | |
// Sans-serif | |
helvetica: ( | |
light: ( | |
family: (Helvetica Neue, Helvetica, Arial, sans-serif), | |
weight: 200, | |
style: normal, | |
font-face: ( | |
family: 'Helvetica Neue', | |
path: 'HelveticaNeue/HelveticaNeue-Light', | |
formats: (eot woff ttf svg) | |
) | |
), | |
light-italic: ( | |
family: (Helvetica Neue, Helvetica, Arial, sans-serif), | |
weight: 200, | |
style: italic, | |
font-face: ( | |
family: 'Helvetica Neue', | |
path: 'HelveticaNeue/HelveticaNeue-LightItalic', | |
formats: (eot woff ttf svg) | |
) | |
), | |
regular: ( | |
family: (Helvetica Neue, Helvetica, Arial, sans-serif), | |
weight: 400, | |
style: normal, | |
font-face: ( | |
family: 'Helvetica Neue', | |
path: 'HelveticaNeue/HelveticaNeue-Regular', | |
formats: (eot woff ttf svg) | |
) | |
), | |
regular-italic: ( | |
family: (Helvetica Neue, Helvetica, Arial, sans-serif), | |
weight: 400, | |
style: italic, | |
font-face: ( | |
family: 'Helvetica Neue', | |
path: 'HelveticaNeue/HelveticaNeue-RegularItalic', | |
formats: (eot woff ttf svg) | |
) | |
), | |
bold: ( | |
family: (Helvetica Neue, Helvetica, Arial, sans-serif), | |
weight: 700, | |
style: normal, | |
font-face: ( | |
family: 'Helvetica Neue', | |
path: 'HelveticaNeue/HelveticaNeue-Bold', | |
formats: (eot woff ttf svg) | |
) | |
), | |
bold-italic: ( | |
family: (Helvetica Neue, Helvetica, Arial, sans-serif), | |
weight: 700, | |
style: italic, | |
font-face: ( | |
family: 'Helvetica Neue', | |
path: 'HelveticaNeue/HelveticaNeue-BoldItalic', | |
formats: (eot woff ttf svg) | |
) | |
), | |
), | |
// Serif | |
georgia: ( | |
regular: ( | |
family: (Georgia, Times, Times New Roman, serif), | |
weight: 400, | |
style: normal | |
), | |
regular-italic: ( | |
family: (Georgia, Times, Times New Roman, serif), | |
weight: 400, | |
style: italic | |
), | |
), | |
); | |
/// Fetch nested keys | |
/// | |
/// @param {Map} $map - Map | |
/// @param {Arglist} $keys - Keys to fetch | |
/// | |
/// @return {*} | |
@function map-deep-get($map, $keys...) { | |
@each $key in $keys { | |
@if type-of($map) != "map" { | |
@warn '`#{$map}` is not a map.'; | |
@return false; | |
} | |
$map: map-get($map, $key); | |
} | |
@return $map; | |
} | |
/// Checks if a list contains a value(s). | |
/// | |
/// @param {List} $list - The list to check against. | |
/// @param {List} $values - A single value or list of values to check for. | |
/// | |
/// @example | |
/// contains($list, $value) | |
/// | |
/// @return {Bool} | |
@function contains($list, $values...) { | |
@each $value in $values { | |
@if type-of(index($list, $value)) != 'number' { | |
@return false; | |
} | |
} | |
@return true; | |
} | |
/// Font styling shorthand | |
/// | |
/// @param {String} $group | |
/// @param {String} $variant | |
/// @param {Map} $properties | |
/// @param {Map} $font-stack (optional) | |
/// | |
/// @example | |
/// @include font(helvetica, bold); | |
/// | |
/// @requires {function} font-properties | |
@mixin font($group, $variant: regular, $properties: family weight style, $font-stack: $type-stack){ | |
$font-properties: map-deep-get($font-stack, $group, $variant); | |
@if $font-properties { | |
// @include track-fonts($group, $variant); | |
@each $key, $value in $font-properties { | |
@if contains($properties, $key) { | |
font-#{$key}: $value; | |
} | |
} | |
} | |
} | |
/// CSS declaration | |
h1 { | |
@include font(helvetica, bold); | |
} | |
h1 .caption { | |
@include font(helvetica, light-italic, weight style); | |
} | |
p { | |
@include font(helvetica, regular); | |
} | |
p i { | |
@include font(helvetica, regular-italic, style); | |
} | |
p b { | |
@include font(helvetica, bold, weight); | |
} | |
blockquote { | |
@include font(georgia); | |
} | |
/// Import fonts | |
// @include import-fonts(); |
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
h1 { | |
font-family: Helvetica Neue, Helvetica, Arial, sans-serif; | |
font-weight: 700; | |
font-style: normal; | |
} | |
h1 .caption { | |
font-weight: 200; | |
font-style: italic; | |
} | |
p { | |
font-family: Helvetica Neue, Helvetica, Arial, sans-serif; | |
font-weight: 400; | |
font-style: normal; | |
} | |
p i { | |
font-style: italic; | |
} | |
p b { | |
font-weight: 700; | |
} | |
blockquote { | |
font-family: Georgia, Times, Times New Roman, serif; | |
font-weight: 400; | |
font-style: normal; | |
} |
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
{ | |
"sass": { | |
"compiler": "dart-sass/1.32.12", | |
"extensions": {}, | |
"syntax": "SCSS", | |
"outputStyle": "expanded" | |
}, | |
"autoprefixer": false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment