typekit/webfontloader

Preload custom fonts on scss file.

Opened this issue · 0 comments

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?