| 1 |
// Used for creating the source string for fonts using @font-face |
| 2 |
// Reference: http://goo.gl/Ru1bKP |
| 3 |
|
| 4 |
@function font-url-prefixer($asset-pipeline) { |
| 5 |
@if $output-bourbon-deprecation-warnings == true { |
| 6 |
@warn "[Bourbon] [Deprecation] `font-url-prefixer` is deprecated and " + |
| 7 |
"will be removed in 5.0.0."; |
| 8 |
} |
| 9 |
|
| 10 |
@if $asset-pipeline == true { |
| 11 |
@return font-url; |
| 12 |
} @else { |
| 13 |
@return url; |
| 14 |
} |
| 15 |
} |
| 16 |
|
| 17 |
@function font-source-declaration( |
| 18 |
$font-family, |
| 19 |
$file-path, |
| 20 |
$asset-pipeline, |
| 21 |
$file-formats, |
| 22 |
$font-url) { |
| 23 |
|
| 24 |
@if $output-bourbon-deprecation-warnings == true { |
| 25 |
@warn "[Bourbon] [Deprecation] `font-source-declaration` is deprecated " + |
| 26 |
"and will be removed in 5.0.0."; |
| 27 |
} |
| 28 |
|
| 29 |
$src: (); |
| 30 |
|
| 31 |
$formats-map: ( |
| 32 |
eot: "#{$file-path}.eot?#iefix" format("embedded-opentype"), |
| 33 |
woff2: "#{$file-path}.woff2" format("woff2"), |
| 34 |
woff: "#{$file-path}.woff" format("woff"), |
| 35 |
ttf: "#{$file-path}.ttf" format("truetype"), |
| 36 |
svg: "#{$file-path}.svg##{$font-family}" format("svg") |
| 37 |
); |
| 38 |
|
| 39 |
@each $key, $values in $formats-map { |
| 40 |
@if contains($file-formats, $key) { |
| 41 |
$file-path: nth($values, 1); |
| 42 |
$font-format: nth($values, 2); |
| 43 |
|
| 44 |
@if $asset-pipeline == true { |
| 45 |
$src: append($src, font-url($file-path) $font-format, comma); |
| 46 |
} @else { |
| 47 |
$src: append($src, url($file-path) $font-format, comma); |
| 48 |
} |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
@return $src; |
| 53 |
} |