Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preload custom fonts on scss file. #452

Open
andresclua opened this issue Aug 10, 2023 · 0 comments
Open

Preload custom fonts on scss file. #452

andresclua opened this issue Aug 10, 2023 · 0 comments

Comments

@andresclua
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant