I had built a website with React.js and webpack.
I want to use Google fonts in the webpage, so I put the link in the section.
In some cases your font resource maybe somewhere in your project directory. So you can load it like this using SCSS
$list: (
"Black",
"BlackItalic",
"Bold",
"BoldItalic",
"Italic",
"Light",
"LightItalic",
"Medium",
"MediumItalic",
"Regular",
"Thin",
"ThinItalic"
);
@mixin setRobotoFonts {
@each $var in $list {
@font-face {
font-family: "Roboto-#{$var}";
src: url("../fonts/Roboto-#{$var}.ttf") format("ttf");
}
}
}
@include setRobotoFonts();