Skip to content

Commit

Permalink
fix(font-path-var): allow font-path default to be overwritten (#172)
Browse files Browse the repository at this point in the history
* fix(font-path-var): allow font-path default to be overwritten

* refactor(font-face): remove font-weight 200 and param

* fix(font-face): re-add font-path param

Error for wrong number of args

* fix(font-face): nvm! remove font-path param again
  • Loading branch information
hellobrian authored and Chris Dhanaraj committed Jun 9, 2017
1 parent 1a2d80f commit 698c234
Showing 1 changed file with 10 additions and 25 deletions.
35 changes: 10 additions & 25 deletions src/globals/scss/_css--font-face.scss
Original file line number Diff line number Diff line change
@@ -1,77 +1,62 @@
$font-path: 'https://unpkg.com/[email protected]/src/globals/fonts/' !default;

@import 'import-once';

@mixin font-face-css($path) {
@mixin font-face-css {
// Default font directory, `!default` flag allows user override.
// (font files are configured to be served as static assets from server.js)
$font-path: '#{$path}' !default;

@font-face {
font-family: 'IBM Helvetica';
font-style: normal;
font-weight: 200;
src: url('#{$font-path}/helvetica-neue-light.woff2') format('woff2'),
url('#{$font-path}/helvetica-neue-light.woff') format('woff')
}

@font-face {
font-family: 'IBM Helvetica';
font-style: italic;
font-weight: 200;
src: url('#{$font-path}/helvetica-neue-light-italic.woff2') format('woff2'),
url('#{$font-path}/helvetica-neue-light-italic.woff') format('woff')
}

@font-face {
font-family: 'IBM Helvetica';
font-style: normal;
font-weight: 300;
src: url('#{$font-path}/helvetica-neue-light.woff2') format('woff2'),
url('#{$font-path}/helvetica-neue-light.woff') format('woff')
url('#{$font-path}/helvetica-neue-light.woff') format('woff');
}

@font-face {
font-family: 'IBM Helvetica';
font-style: italic;
font-weight: 300;
src: url('#{$font-path}/helvetica-neue-light-italic.woff2') format('woff2'),
url('#{$font-path}/helvetica-neue-light-italic.woff') format('woff')
url('#{$font-path}/helvetica-neue-light-italic.woff') format('woff');
}

@font-face {
font-family: 'IBM Helvetica';
font-style: normal;
font-weight: 400;
src: url('#{$font-path}/helvetica-neue-roman.woff2') format('woff2'),
url('#{$font-path}/helvetica-neue-roman.woff') format('woff')
url('#{$font-path}/helvetica-neue-roman.woff') format('woff');
}

@font-face {
font-family: 'IBM Helvetica';
font-style: italic;
font-weight: 400;
src: url('#{$font-path}/helvetica-neue-roman-italic.woff2') format('woff2'),
url('#{$font-path}/helvetica-neue-roman-italic.woff') format('woff')
url('#{$font-path}/helvetica-neue-roman-italic.woff') format('woff');
}

@font-face {
font-family: 'IBM Helvetica';
font-style: normal;
font-weight: 700;
src: url('#{$font-path}/helvetica-neue-bold.woff2') format('woff2'),
url('#{$font-path}/helvetica-neue-bold.woff') format('woff')
url('#{$font-path}/helvetica-neue-bold.woff') format('woff');
}

@font-face {
font-family: 'IBM Helvetica';
font-style: italic;
font-weight: 700;
src: url('#{$font-path}/helvetica-neue-bold-italic.woff2') format('woff2'),
url('#{$font-path}/helvetica-neue-bold-italic.woff') format('woff')
url('#{$font-path}/helvetica-neue-bold-italic.woff') format('woff');
}
}

@include exports('css--font-face') {
@if global-variable-exists('css--font-face') and $css--font-face == true {
@include font-face-css('https://unpkg.com/[email protected]/src/globals/fonts/');
@include font-face-css;
}
}

0 comments on commit 698c234

Please sign in to comment.