The font-face feature seems to be malfunctioning across all browsers

I'm encountering difficulties with rendering fonts on my react application. I'm unsure of what I might be doing incorrectly. I have implemented font-face in my project and here is a snippet from my font.styl file.

All the fonts are located in the public directory. https://i.sstatic.net/VNXKB.png

font.styl

@font-face
    font-family 'museo_sans700'
    src url('/public/fonts/museosans_0-webfont.woff2') format('woff2')
        url('/public/fonts/museosans_0-webfont.woff') format('woff')
    font-weight normal
    font-style normal

@font-face
    font-family 'museo_sans300'
    src url('/public/fonts/museosans-300-webfont.woff2') format('woff2')
        url('/public/fonts/museosans-300-webfont.woff') format('woff')
    font-weight normal
    font-style normal

@font-face
    font-family 'museo_sans500'
    src url('/public/fonts/museosans-webfont.woff2') format('woff2')
        url('/public/fonts/museosans-webfont.woff') format('woff')
    font-weight normal
    font-style normal

@font-face
    font-family 'montserratregular'
    src url('/public/fonts/montserrat-regular-webfont.woff2') format('woff2')
        url('/public/fonts/montserrat-regular-webfont.woff') format('woff')
    font-weight normal
    font-style normal

This is a segment from my base.styl:

@import './bs-custom.styl'
@import './fonts.styl'

html
    width 100%
    height 100%

body
    width 100vw
    min-height 100vh
    transition all 0.2s ease
    background-color #F0F0F0

    color theme_text
    font-size 14px
    font-weight 400
    font-family museo500

    overflow hidden

The following configuration for font loading is being used:

{
                test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
                loader: 'url-loader?limit=100000&mimetype=application/font-woff'
            },

However, the fonts are still not displaying properly.

Answer №1

There was a bug in my code that I finally caught. It turns out, I was missing a comma after the src url(...)

 src url('/public/fonts/museosans_0-webfont.woff2') format('woff2'),
        url('/public/fonts/museosans_0-webfont.woff') format('woff')

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Leveraging packages obtained from npm repositories

Recently, I came across this guide about React that included a paragraph that left me puzzled. According to the guide, CommonJS modules (found in npm) cannot be directly used in web browsers due to technical limitations. Instead, you need a JavaScript " ...

Adding data to a JSON object using AngularJS

When attempting to insert an object into a JSON object, I am encountering an issue where it duplicates the JSON object. Here is a breakdown of the scenario: <input type="text" style="width: 40% !important;" placeholder="Nom" class="input-sm" ng-model= ...

Incorporate hover and click functionality to the dropdown button using JQuery

Recently, I implemented hover and click events to trigger the opening of a dropdown content The functionality is mostly working as expected but there is a slight issue When hovering over the element, the content opens and closes properly However, on the ...

The coordinates of the event do not match the coordinates of the location. Successful AJAX response data

How can I retrieve the accurate latitude and longitude when the Google Maps marker finishes dragging? It's confusing because for the same exact point, two different (but very approximate) coordinates are provided. Here are some example results for t ...

Building a Custom Date Selector in React_JS: A Step-By-Step Guide

Experimented with various approaches to create a date picker in reactJS. Utilized the "react-datepicker" package and received "Wed May 15 2019 12:54:33 GMT+0100" as output, but aiming for the format 12/12/2000. ...

Is it possible to align images vertically with text in a multi-column Bootstrap 4 container?

Inquiring on how to achieve vertical center alignment of text and images for a website section similar to the one shown in this image: https://i.sstatic.net/s8gNh.jpg. The intention is to align the logos and the corresponding text of company names situated ...

Why is the date loaded in the link function not binding to the newly created HTML in the directive?

How can I write a directive to handle repetitive code? In this example, I need to load data from attachmentUsageService and generate HTML. The service successfully loads the data in the first step, but the data is not bound to the created HTML element. See ...

Altering the color upon repetition and utilizing JQuery coordinates for the dynamic movement of elements

I've been working on recreating some JQuery tutorials by myself, but I've hit a roadblock. My goal is to create an object that moves from one position to another while changing color when it repeats. I attempted to achieve this by using an array ...

Encountered a 502 Bad Gateway error when trying to access a React application running in

I am encountering a 502 Bad Gateway error when trying to open my multi-container docker app in React with Nginx as the server. The error message received is: 2021/12/30 11:58:44 [error] 31#31: *31 connect() failed (111: Connection refused) while connecting ...

Fetching weather data from the Darksky.com API in JSON format

My goal is to retrieve weather data in JSON format from the Darksky.com API. To do this, I first successfully obtained my latitude and longitude using the freegoip.com API. However, the Darksky API requires both longitude and latitude before it can provid ...

Displaying images within a table using innerHTML (Javascript / Html)

Let's start off with some important details: I have a dynamic table that is being generated. The structure of the table is as follows: |item__ | price | category | category | category | category | picture | |chicken| $20 | _______ |_ ______ ...

Testing for undefined using the 'should' syntax in Chai

Inspired by this tutorial on testing an AngularJS app with Chai, I am trying to add a test for an undefined value using the "should" style. However, I encountered a failure when attempting this: it ('cannot play outside the board', function() { ...

Customize the overlay color using the theme's background color

I want to create an overlay on my webpage that covers all the content. However, I'm facing a challenge because my website allows users to customize the theme colors, and the overlay div does not adopt these color changes automatically. To rectify this ...

Breaking down objects and setting default values

In need of assistance with resolving an issue related to default parameters and object destructuring. The 'product' object that I am working with has the following structure: { name: "Slip Dress", priceInCents: 8800, availableSizes ...

How can I prevent Heroku from automatically running the script with 'npm start'?

I am currently in the process of developing a server-based application that utilizes automated scripts, also known as "bots," within a cloud environment. I have set up Heroku Scheduler to execute one of these scripts automatically, as illustrated in Figure ...

The provided property `verseObj.version_id` is not valid. It should be of type `object`, but a `string` value has been supplied

I am currently developing a unique and innovative public prayer journal that allows for the addition of verses in full stack. Surprisingly, I encountered an error when rendering the form which was not present a few days ago. Strangely enough, I have made n ...

scrolling malfunction

I encountered a problem with the scroll feature in this image: The problem is that I only want the vertical scroll to show up, not the horizontal scroll. I tried using the overflow:scroll attribute in my code. Will it display the same in Firefox and IE, o ...

Troubleshooting: Bootstrap 4 Flexbox demos failing to function

I am currently in the process of developing a basic Express webserver that serves a landing page constructed with bootstrap. However, I am encountering issues with getting any Flexbox examples to properly function. Displayed below is my landing page. Is t ...

Having trouble understanding why the content in my div becomes cramped when the div collapses

Currently, I am working on a portfolio page in React. One issue I'm facing is that when I collapse a div, the content gets scrunched up and I can't figure out what's causing it. I tried using "white-space: nowrap;" but it doesn't seem t ...

Navigating dynamic web pages on Node.js: best practices

I am currently utilizing Node.js (Express.js) and EJS for my project. My main concern is managing dynamic pages. By dynamic, I mean allowing the admin to create a page that can be accessed and rendered based on the category name. Typically, I would handl ...