Skip to content

Instantly share code, notes, and snippets.

@nathansmith
Last active January 8, 2020 16:17
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 nathansmith/208af93d0b4bfff43e98a4c08beb22d7 to your computer and use it in GitHub Desktop.
Save nathansmith/208af93d0b4bfff43e98a4c08beb22d7 to your computer and use it in GitHub Desktop.
Sass font override example
// ==================
// In variables file.
// ==================
$font-size-h1: 2.2rem !default;
$font-family-h1: inherit !default;
$font-weight-h1: inherit !default;
// =================
// In headings file.
// =================
h1 {
font-size: $font-size-h1;
font-weight: $font-weight-h1;
/*
In all browsers, `font-family`
behaves like "inherit" by default.
So we only need this if it has
been set to something specific.
*/
@if ($font-family-h1 != inherit) {
font-family: $font-family-h1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment