Skip to content

Preload custom fonts on scss file. #452

@andresclua

Description

@andresclua

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions