Webfonts are not loaded
See original GitHub issueLooks 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:
- Created 8 years ago
- Comments:12 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
@PrimozRome I’ve done a little more investigating. Is it possible this is your problem?