fontfaceobserver icon indicating copy to clipboard operation
fontfaceobserver copied to clipboard

Fonts fail to load

Open rctneil opened this issue 4 years ago • 4 comments

My code is below but the fonts never load. I just get "Bitter failed to load" showing in the console. Is there any reasons that could make this happen. Any suggestions with how to resolve it?

import FontFaceObserver from 'fontfaceobserver'

document.addEventListener("turbolinks:load", function() {
    let font = new FontFaceObserver('Bitter', {
        weight: 400
    })

    font.load().then(function () {
        console.log('Bitter has loaded.')
    }).catch(function () {
        console.log('Bitter failed to load.')
    })
})

rctneil avatar Apr 28 '20 19:04 rctneil

I am using this inside Webpacker. Would this make a difference?

rctneil avatar Apr 29 '20 17:04 rctneil

Do you have the @font-face rules in your CSS?

bramstein avatar May 16 '22 09:05 bramstein

Hi bramstien,

Lion-El avatar Nov 28 '23 13:11 Lion-El

I am getting the error: Failed to load resource: the server responded with a status of 404 () with the deployed version on github but works fine locally. error points to fontfaceobserver.js:1

Lion-El avatar Nov 28 '23 13:11 Lion-El