cv-website

Personal website and CV
git clone https://git.in0rdr.ch/cv-website.git
Log | Files | Refs | Pull requests |Archive | README | LICENSE

_font-source-declaration.scss (1047B)


      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 $asset-pipeline == true {
      6     @return font-url;
      7   } @else {
      8     @return url;
      9   }
     10 }
     11 
     12 @function font-source-declaration(
     13   $font-family,
     14   $file-path,
     15   $asset-pipeline,
     16   $file-formats,
     17   $font-url) {
     18 
     19   $src: ();
     20 
     21   $formats-map: (
     22     eot:   "#{$file-path}.eot?#iefix" format("embedded-opentype"),
     23     woff2: "#{$file-path}.woff2" format("woff2"),
     24     woff:  "#{$file-path}.woff" format("woff"),
     25     ttf:   "#{$file-path}.ttf" format("truetype"),
     26     svg:   "#{$file-path}.svg##{$font-family}" format("svg")
     27   );
     28 
     29   @each $key, $values in $formats-map {
     30     @if contains($file-formats, $key) {
     31       $file-path: nth($values, 1);
     32       $font-format: nth($values, 2);
     33 
     34       @if $asset-pipeline == true {
     35         $src: append($src, font-url($file-path) $font-format, comma);
     36       } @else {
     37         $src: append($src, url($file-path) $font-format, comma);
     38       }
     39     }
     40   }
     41 
     42   @return $src;
     43 }