Skip to content

Commit 973ee20

Browse files
committed
add font-format option for font-face mixin
1 parent 327420c commit 973ee20

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

lib/web/css/source/lib/_typography.less

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
.lib-font-face(
1111
@family-name,
1212
@font-path,
13+
@font-format: false,
1314
@font-weight: normal,
1415
@font-style: normal,
1516
@font-display: auto
16-
) {
17+
) when (@font-format = false) {
1718
@font-face {
1819
font-family: @family-name;
1920
src: url('@{font-path}.woff2') format('woff2'),
@@ -24,6 +25,23 @@
2425
}
2526
}
2627

28+
.lib-font-face(
29+
@family-name,
30+
@font-path,
31+
@font-format: false,
32+
@font-weight: normal,
33+
@font-style: normal,
34+
@font-display: auto
35+
) when not (@font-format = false) {
36+
@font-face {
37+
font-family: @family-name;
38+
src: url('@{font-path}.@{font-format}') format(@font-format);
39+
font-weight: @font-weight;
40+
font-style: @font-style;
41+
font-display: @font-display;
42+
}
43+
}
44+
2745
// Rem font size
2846
.lib-font-size(@sizeValue) when not (ispercentage(@sizeValue)) and not (@sizeValue = false) and (isunit(@sizeValue, @font-size-unit)) {
2947
.lib-css(font-size, @sizeValue);

0 commit comments

Comments
 (0)