3 /// Builds the `src` list for an `@font-face` declaration.
5 /// @link https://goo.gl/Ru1bKP
7 /// @argument {string} $font-family
9 /// @argument {string} $file-path
11 /// @argument {boolean} $asset-pipeline
13 /// @argument {list} $file-formats
17 /// @require {function} _contains
21 @function _font-source-declaration(
30 "woff2": "#{$file-path}.woff2" format("woff2"),
31 "woff": "#{$file-path}.woff" format("woff"),
34 @each $format in $file-formats {
35 @if _contains(map-keys($formats-map), $format) {
36 $value: map-get($formats-map, $format);
37 $file-path: nth($value, 1);
38 $font-format: nth($value, 2);
40 @if $asset-pipeline == true {
41 $src: append($src, font-url($file-path) $font-format, comma);
43 $src: append($src, url($file-path) $font-format, comma);
46 @error "`#{$file-formats}` contains an unsupported font file format. " +
47 "Must be `woff` and/or `woff2`.";