question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Webfonts are not loaded

See original GitHub issue

Looks like url-loader does not solve out web fonts in my CSS files ok… My main CSS file is included in main.js like this:

import './assets/scss/main.scss'

in the css I reference some web fonts

@font-face {
    font-family: 'pages-icon';
    src:url('../fonts/pages-icon/icons.eot?-u69vo5');
    src:url('../fonts/pages-icon/icons.eot?#iefix-u69vo5') format('embedded-opentype'),
        url('../fonts/pages-icon/icons.woff?-u69vo5') format('woff'),
        url('../fonts/pages-icon/icons.ttf?-u69vo5') format('truetype'),
        url('../fonts/pages-icon/icons.svg?-u69vo5#Pages-icon') format('svg');
    font-weight: normal;
    font-style: normal;
}

The icons aren’t loaded by the browser. I then tested npm run build and investigated the build and the fonts files are included in the static folder but not sure why are not loaded when I run app in the browser.

My font loaders in the webpack config are:

  {
    test: /\.woff/,
    loader: 'url?prefix=font/&limit=10000&mimetype=application/font-woff'
  }, {
    test: /\.ttf/,
    loader: 'file?prefix=font/'
  },
  {
    test: /\.eot/,
    loader: 'file?prefix=font/'
  },
  {
    test: /\.svg/,
    loader: 'file?prefix=font/'
  },

Any idea?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

11reactions
PrimozRomecommented, Mar 10, 2016

With some trail-and-error with my webpack configuration I have somehow find the loader configuration for the web fonts… This one works, don’t ask my why. Tried at list 10 different setups and this one finally worked

      {
        test: /\.(woff|woff2|eot|ttf|svg)(\?.*$|$)/,
        loader: 'url-loader?importLoaders=1&limit=100000'
      },

0reactions
chrisvfritzcommented, Mar 22, 2016

@PrimozRome I’ve done a little more investigating. Is it possible this is your problem?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why are my web-fonts not loading on my site? - Stack Overflow
Try to change the permission of "fonts" folder, or maybe the cause is the fonts files names with uppercase "socialFontsMichael", change it to ......
Read more >
How to load web fonts to avoid performance issues and speed ...
How to load web fonts to avoid performance issues and speed up page loading · Use the correct font format · Preload fonts...
Read more >
Optimize WebFont loading and rendering - web.dev
This post explains how to load WebFonts to prevent layout shifts and blank pages when WebFonts are not available when the page loads....
Read more >
The Best Font Loading Strategies and How to Execute Them
Step 1: Use fallback font when web fonts aren't loaded yet. · Step 2: Load the Roman (also called “book” or “regular”) version...
Read more >
Smart WebFont loading for better performance
Practically every modern new website gracefully relies on Custom Webfonts. Web-fonts are fonts that are not available in the browser by default. They...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found