Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Apr 16, 2021

Conversation

DiHalt-ECP
Copy link
Contributor

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
Copy link
Owner

Igosuki commented Apr 16, 2021

Ok I see the added value in most cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants