Preload custom fonts on scss file.
Author: andrescluaCreated Aug 10, 2023Updated Aug 10, 2023
Hi there, I was wondering how you can make this library work with SCSS files.
In the past I was working with a configuration that looks like below
WebFont.load({
custom: {
families: ['fff-regular', 'fff-italic'],
urls: ['/assets/fonts.css']
},
active: () => {
store.dispatch(fontsLoaded(true))
}
})But for some projects that I'm working right now I can't.
import WebFont from "webfontloader";
import pathtoFonts from './../styles/framework/foundation/font/font.scss'
// https://github.com/typekit/webfontloader
export const prefetchFonts = () =>
new Promise((resolve) => {
WebFont.load({
custom: {
families: ['Uncut Sans'],
urls: [pathtoFonts]
},
active: resolve,
});
});Any Tip / suggestion how to solve it?
Source: typekit/webfontloader