Answer the question
In order to leave comments, you need to log in
How to specify font style for @mixin @font-face element in Gulp/SASS?
Please help a beginner. I can't figure out if I'm doing the right thing or not. Build on GULP / Sass.
In style.scss
@mixin font($font_name, $file_name, $weight, $style) {
@font-face {
font-family: $font_name;
font-display: swap;
src: url("../fonts/#{$file_name}.woff") format("woff"), url("../fonts/#{$file_name}.woff2") format("woff2");
font-weight: #{$weight};
font-style: #{$style};
}
}
@import "fonts";
@include font("Saira", "Saira-Bold", "700", "normal");
@include font("Saira", "Saira-Medium", "500", "normal");
@include font("Saira", "Saira-Regular", "400", "normal");
@include font("Saira", "Saira-SemiBold", "600", "normal");
@font-face {
font-family: "Saira";
font-display: swap;
src: url("../fonts/Saira-Bold.woff") format("woff"), url("../fonts/Saira-Bold.woff2") format("woff2");
font-weight: 700;
font-style: normal;
}
@font-face {
font-family: "Saira";
font-display: swap;
src: url("../fonts/Saira-Medium.woff") format("woff"), url("../fonts/Saira-Medium.woff2") format("woff2");
font-weight: 500;
font-style: normal;
}
and so on Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question