Igosuki / compass-mixins

A collection of compass' stylesheet for bower dependencies and libsass
Other
592 stars 197 forks source link

Added helper functions font-files & font-url, which are used in the @font-face mixin. #112

Closed DiHalt-ECP closed 3 years ago

DiHalt-ECP commented 5 years ago

Ported helper functions font-files() and font-url(), used in the @font-face mixin.

Helper function to create a list of font files for the src attribute in @font-face. In the global variable $font-path, you can specify the path to the folder with fonts relative to style files, by default the path to the fonts is "fonts".

Usage:

font-files ('file-name-w-ext'[, 'format'][,'file-name-w-ext'[, 'format']]...)

If the font format is not specified, the function will add the format corresponding to the file extension.

use mixin this way:

$font-path: "/public/fonts/roboto";
@include font-face(
    'Roboto',
    font_files("roboto.ttf", "roboto.woff", "roboto.woff2"),
    // font_files("roboto.ttf", "truetype", "roboto.woff", "roboto.woff2"),
    "roboto.eot",    // [$eot]
    normal,          // [$weight]
    normal           // [$style]
);
Igosuki commented 3 years ago

Ok I see the added value in most cases.