V
V
Vladimir Skvortsov2018-07-04 16:43:52
css
Vladimir Skvortsov, 2018-07-04 16:43:52

Why doesn't @font-face include the font?

The @font-face directive just doesn't include the font, no errors, no nothing.
Already simplified everything as soon as I could, but I still can not find the root of the problem.
The resulting file structure is:
node_modules
public
      index.css
      Lato-Bold.ttf
views
      index.pug
app.js
package.json
index.css

@font-face {
  font-family: Lato;
  src: url(Lato-bold.ttf);
}

index.pug
doctype html
html
  head
    meta(charset='utf-8')
    title Document

    link(rel='stylesheet' href='./index.css')
  body

app.js
const express = require('express');

const app = express();

app.set('views', 'views');
app.set('view engine', 'pug');

app.use(express.static('public'));

app.get('/', (request, response) => response.render(''));

app.listen(8040);

package.json
{
  "dependencies": {
    "express": "^4.16.3",
    "pug": "^2.0.3"
  }
}

Networks is empty
5b3ccec7dbfc7033130125.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Skvortsov, 2018-07-05
@northernwhale


The @font-face rule is designed to allow lazy loading of fonts, fonts are only downloaded when needed for use within a document. a stylesheet can include @font-face rules for a library of fonts of which only a select set are used; user agents must only download those fonts that are referred to within the style rules applicable to a given page. User agents that download all fonts defined in @font-face rules without considering whether those fonts are in fact used within a page are considered non-conformant.
In general, it was a stupid idea to check font loading only through devtools, without applying these fonts anywhere.

S
SANYAAAASSSS, 2018-07-04
@SANYAAAASSSS

Have you tried this format?

@font-face {
  font-family: ProximaNova-Light;
  src: url(../font/ProximaNova/ProximaNova-Light.otf) format("opentype");
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question