0
|
1 @charset "UTF-8";
|
|
2
|
|
3 /// Builds the `src` list for an `@font-face` declaration.
|
|
4 ///
|
|
5 /// @link http://goo.gl/Ru1bKP
|
|
6 ///
|
|
7 /// @argument {string} $font-family
|
|
8 ///
|
|
9 /// @argument {string} $file-path
|
|
10 ///
|
|
11 /// @argument {boolean} $asset-pipeline
|
|
12 ///
|
|
13 /// @argument {list} $file-formats
|
|
14 ///
|
|
15 /// @return {list}
|
|
16 ///
|
|
17 /// @require {function} _contains
|
|
18 ///
|
|
19 /// @access private
|
|
20
|
|
21 @function _font-source-declaration(
|
|
22 $font-family,
|
|
23 $file-path,
|
|
24 $asset-pipeline,
|
|
25 $file-formats
|
|
26 ) {
|
|
27
|
|
28 $src: ();
|
|
29
|
|
30 $formats-map: (
|
|
31 eot: "#{$file-path}.eot?#iefix" format("embedded-opentype"),
|
|
32 woff2: "#{$file-path}.woff2" format("woff2"),
|
|
33 woff: "#{$file-path}.woff" format("woff"),
|
|
34 ttf: "#{$file-path}.ttf" format("truetype"),
|
|
35 svg: "#{$file-path}.svg##{$font-family}" format("svg"),
|
|
36 );
|
|
37
|
|
38 @each $key, $values in $formats-map {
|
|
39 @if _contains($file-formats, $key) {
|
|
40 $file-path: nth($values, 1);
|
|
41 $font-format: nth($values, 2);
|
|
42
|
|
43 @if $asset-pipeline == true {
|
|
44 $src: append($src, font-url($file-path) $font-format, comma);
|
|
45 } @else {
|
|
46 $src: append($src, url($file-path) $font-format, comma);
|
|
47 }
|
|
48 }
|
|
49 }
|
|
50
|
|
51 @return $src;
|
|
52 }
|