Skip to content

Instantly share code, notes, and snippets.

@MrBlank
Last active March 8, 2018 19:38
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 MrBlank/69b7be49040d0d81975c23c9896f4181 to your computer and use it in GitHub Desktop.
Save MrBlank/69b7be49040d0d81975c23c9896f4181 to your computer and use it in GitHub Desktop.
/**
* Open Sans
*/
// We are only suporting .woff formats. Add more if you need them.
// Import using a mixin. Set booliam value to 'true' on the weights needed to import. The defaults are all 'false'.
/*
@include font-open-sans(
$light-300: 'true',
$regular-400: 'true',
$semibold-600: 'true',
$bold-700: 'true',
$extrabold-800: 'true'
);
*/
$font-path: '../fonts';
@mixin font-open-sans(
$light-300: 'false',
$regular-400: 'false',
$semibold-600: 'false',
$bold-700: 'false',
$extrabold-800: 'false'
)
{
// Light 300
@if $light-300 == 'true' {
@font-face {
font-family: 'Open Sans';
src: url('#{$font-path}/OpenSans-Light-webfont.woff') format('woff');
font-weight: 300;
font-style: normal;
}
@font-face {
font-family: 'Open Sans';
src: url('#{$font-path}/OpenSans-LightItalic-webfont.woff') format('woff');
font-weight: 300;
font-style: italic;
}
}
// Regular 400
@if $regular-400 == 'true' {
@font-face {
font-family: 'Open Sans';
src: url('#{$font-path}/OpenSans-Regular-webfont.woff') format('woff');
font-weight: 400;
font-style: normal;
}
@font-face {
font-family: 'Open Sans';
src: url('#{$font-path}/OpenSans-Italic-webfont.woff') format('woff');
font-weight: 400;
font-style: italic;
}
}
// Semibold 600
@if $semibold-600 == 'true' {
@font-face {
font-family: 'Open Sans';
src: url('#{$font-path}/OpenSans-Semibold-webfont.woff') format('woff');
font-weight: 600;
font-style: normal;
}
@font-face {
font-family: 'Open Sans';
src: url('#{$font-path}/OpenSans-SemiboldItalic-webfont.woff') format('woff');
font-weight: 600;
font-style: italic;
}
}
// Bold 700
@if $bold-700 == 'true' {
@font-face {
font-family: 'Open Sans';
src: url('#{$font-path}/OpenSans-Bold-webfont.woff') format('woff');
font-weight: 700;
font-style: normal;
}
@font-face {
font-family: 'Open Sans';
src: url('#{$font-path}/OpenSans-BoldItalic-webfont.woff') format('woff');
font-weight: 700;
font-style: italic;
}
}
// Extra Bold 800
@if $extrabold-800 == 'true' {
@font-face {
font-family: 'Open Sans';
src: url('#{$font-path}/OpenSans-ExtraBold-webfont.woff') format('woff');
font-weight: 800;
font-style: normal;
}
@font-face {
font-family: 'Open Sans';
src: url('#{$font-path}/OpenSans-ExtraBoldItalic-webfont.woff') format('woff');
font-weight: 800;
font-style: italic;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment