Skip to content

Create a conditional import for font faces #71

@asantos00

Description

@asantos00

The main idea is to only import the fonts needed on each project (the same approach we do with the mixins, instead of exporting behaviour we don't need, only use what you want)

The main idea was to keep (like a registry) of the imported fonts

(Pseudo code below, it will have lots of errors and won't be complete)

$base-font-path : "fonts/"
$fonts : ();

@mixin font($name = "IntervalNextSemiBold") {
   $font-already-imported: map-get($fonts, $name);

   @if(!$font-already-imported) {
       $fonts : map-set($fonts, $name, true);
       @include font-face($name, "${$base-font-path}/intervalnext-semibold", null, null, woff2 woff eot);
   }

   @return "font-family: ${name}, sans-serif"   
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions