This repository has been archived by the owner on Aug 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_tools.family.scss
55 lines (51 loc) · 1.71 KB
/
_tools.family.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// ==========================================================================||
// Mixin for setting font-family and font-weight
// ==========================================================================||
// Changelog
// 2.0.0 - created
// ==========================================================================||
@mixin sf-family($family, $weight: "regular", $important: false) {
$impt: false;
// Thanks inuitcss!
@if ($important == true) {
$important: !important;
$impt: true;
} @else if ($important == false) {
$important: null;
$impt: false;
} @else {
@error "$important needs to be 'true' or 'false'."
}
@if map-has-key($fonts, $family) {
font-family: map-get($fonts, $family) $important;
font-display: swap;
@if type-of($weight) == "number" {
font-weight: $weight $important;
} @else {
// font-weight
@if $weight == "thin" {
font-weight: 100 $important;
} @else if $weight == "extra-light" {
font-weight: 200 $important;
} @else if $weight == "light" {
font-weight: 300 $important;
} @else if $weight == "regular" {
font-weight: 400 $important;
} @else if $weight == "medium" {
font-weight: 500 $important;
} @else if $weight == "semi-bold" {
font-weight: 600 $important;
} @else if $weight == "bold" {
font-weight: 700 $important;
} @else if $weight == "extra-bold" {
font-weight: 800 $important;
} @else if $weight == "black" {
font-weight: 900 $important;
} @else {
@error "Invalid $weight value passed";
}
}
} @else {
@error "font-family for '#{$family}' is not defined/imported in settings.fonts";
}
}