尽管它们都在CSS中,但浏览器不会要求每个webfont

皮埃尔

我正在使用Jekyll午夜主题Jekyll当前是v3.7.4

我的主题是捆绑的OpenSans网络字体,我还添加了FontAwesome。但是浏览器只请求OpenSans字体,而不请求FontAwesome文件。

在我页面的头部(已编译):

  <!-- theme -->
  <link rel="stylesheet" href="/assets/css/style.css?v=e16a158">
  <!-- theme overrides -->
  <link rel="stylesheet" href="/assets/css/hello.css?v=e16a158">

未编译:

  <!-- theme -->
  <link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.data['hash'] | relative_url }}">
  <!-- theme overrides -->
  <link rel="stylesheet" href="{{ '/assets/css/hello.css?v=' | append: site.data['hash'] | relative_url }}">

hello.scss是我拥有自定义样式的地方。前两行是根据FontAwesome说明进行的操作

---
---
@import "./vendor/fontawesome/fontawesome.scss";
@import "./vendor/fontawesome/brands.scss";

编译后的CSS(位于/assets/css)包含以下内容:

@charset "UTF-8";
/*!
 * Font Awesome Free 5.13.0 by @fontawesome - https://fontawesome.com
 * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
 */

@font-face {
  font-family: 'Font Awesome 5 Brands';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("../fonts/fa-brands-400.eot");
  src: url("../fonts/fa-brands-400.eot?#iefix") format("embedded-opentype"), url("../fonts/fa-brands-400.woff2") format("woff2"), url("../fonts/fa-brands-400.woff") format("woff"), url("../fonts/fa-brands-400.ttf") format("truetype"), url("../fonts/fa-brands-400.svg#fontawesome") format("svg"); }
.fab {
  font-family: 'Font Awesome 5 Brands';
  font-weight: 400; }

获得/assets/fonts/fa-brands-400.woff作品:

$ http :8888/assets/fonts/fa-brands-400.woff
HTTP/1.1 200 OK
cache-control: private, max-age=0, proxy-revalidate, no-store, no-cache, must-revalidate
connection: close
content-length: 89824
content-type: application/font-woff; charset=utf-8
date: Sun, 19 Apr 2020 08:26:19 GMT
etag: 3011a2-15ee0-5e9b582b
last-modified: Sat, 18 Apr 2020 19:42:35 GMT
server: WEBrick/1.4.2 (Ruby/2.6.2/2019-03-13)



+-----------------------------------------+
| NOTE: binary data not shown in terminal |
+-----------------------------------------+

但是,当我使用任何浏览器(尝试使用Firefox,Linux上的Chrome和iOS上的Safari)访问该网站时,它甚至都没有尝试请求FontAwesome字体文件:

Firefox的网络活动:不需要fa-brands- *

有趣的是,在编译的CSS中像这样引用OpenSans字体文件,这对于浏览器发起请求很合适:

@font-face {
  font-family: 'OpenSansLight';
  src: url("../fonts/OpenSans-Light-webfont.eot");
  src: url("../fonts/OpenSans-Light-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Light-webfont.woff") format("woff"), url("../fonts/OpenSans-Light-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Light-webfont.svg#OpenSansLight") format("svg");
  font-weight: normal;
  font-style: normal; }
@font-face {
  font-family: 'OpenSansLightItalic';
  src: url("../fonts/OpenSans-LightItalic-webfont.eot");
  src: url("../fonts/OpenSans-LightItalic-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-LightItalic-webfont.woff") format("woff"), url("../fonts/OpenSans-LightItalic-webfont.ttf") format("truetype"), url("../fonts/OpenSans-LightItalic-webfont.svg#OpenSansLightItalic") format("svg");
  font-weight: normal;
  font-style: normal; }
@font-face {
  font-family: 'OpenSansRegular';
  src: url("../fonts/OpenSans-Regular-webfont.eot");
  src: url("../fonts/OpenSans-Regular-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Regular-webfont.woff") format("woff"), url("../fonts/OpenSans-Regular-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Regular-webfont.svg#OpenSansRegular") format("svg");
  font-weight: normal;
  font-style: normal;
  -webkit-font-smoothing: antialiased; }
@font-face {
  font-family: 'OpenSansItalic';
  src: url("../fonts/OpenSans-Italic-webfont.eot");
  src: url("../fonts/OpenSans-Italic-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Italic-webfont.woff") format("woff"), url("../fonts/OpenSans-Italic-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Italic-webfont.svg#OpenSansItalic") format("svg");
  font-weight: normal;
  font-style: normal;
  -webkit-font-smoothing: antialiased; }
@font-face {
  font-family: 'OpenSansSemibold';
  src: url("../fonts/OpenSans-Semibold-webfont.eot");
  src: url("../fonts/OpenSans-Semibold-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Semibold-webfont.woff") format("woff"), url("../fonts/OpenSans-Semibold-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Semibold-webfont.svg#OpenSansSemibold") format("svg");
  font-weight: normal;
  font-style: normal;
  -webkit-font-smoothing: antialiased; }
@font-face {
  font-family: 'OpenSansSemiboldItalic';
  src: url("../fonts/OpenSans-SemiboldItalic-webfont.eot");
  src: url("../fonts/OpenSans-SemiboldItalic-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-SemiboldItalic-webfont.woff") format("woff"), url("../fonts/OpenSans-SemiboldItalic-webfont.ttf") format("truetype"), url("../fonts/OpenSans-SemiboldItalic-webfont.svg#OpenSansSemiboldItalic") format("svg");
  font-weight: normal;
  font-style: normal;
  -webkit-font-smoothing: antialiased; }
@font-face {
  font-family: 'OpenSansBold';
  src: url("../fonts/OpenSans-Bold-webfont.eot");
  src: url("../fonts/OpenSans-Bold-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Bold-webfont.woff") format("woff"), url("../fonts/OpenSans-Bold-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Bold-webfont.svg#OpenSansBold") format("svg");
  font-weight: normal;
  font-style: normal;
  -webkit-font-smoothing: antialiased; }
@font-face {
  font-family: 'OpenSansBoldItalic';
  src: url("../fonts/OpenSans-BoldItalic-webfont.eot");
  src: url("../fonts/OpenSans-BoldItalic-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-BoldItalic-webfont.woff") format("woff"), url("../fonts/OpenSans-BoldItalic-webfont.ttf") format("truetype"), url("../fonts/OpenSans-BoldItalic-webfont.svg#OpenSansBoldItalic") format("svg");
  font-weight: normal;
  font-style: normal;
  -webkit-font-smoothing: antialiased; }

_config.yml

# Site config
defaults:
  -
    scope:
      path: "" # empty string means everywhere
      type: "pages"
    values:
      layout: "default"

author: "64b.it"
title: "64b.it | custom-built software"
description: "We deliver custom-built software to maximize your business' ROI."
repo: "https://github.com/coaxial/hello"
# Jekyll config
theme: jekyll-theme-midnight
markdown: kramdown
include:
  - assets/vendor/fontawesome
exclude:
  - Gemfile
  - Gemfile.lock

到底是怎么回事?当OpenSans正常工作时,为什么我不能让浏览器甚至请求FontAwesome字体文件?

如果需要更多详细信息,可以在此Netlify部署中四处浏览:https ://5e9c012d3f93e40006beb655--hello-64bit.netlify.app/以及与之对应的代码修订版:https : //github.com/coaxial/hello/tree / e16a1580af9396c8cf2cfafa4944edb86982180a

乔斯特

我单击了以下链接:https : //5e9c012d3f93e40006beb655--hello-64bit.netlify.app/

您的HTML(第71行)显示为:

<i class="fa fa-twitter"></i>

您的hello.css(已解析,第4512行)显示为:

.fab {
  font-family:'Font Awesome 5 Brands';
  font-weight:400
} 

显然,您需要将第71行更改为:

<i class="fab fa-twitter"></i>

祝您编码愉快!

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Laravel 7:浏览器可以看到已编译的CSS文件,但不会应用它们

来自分类Dev

浏览器中的javascript要求

来自分类Dev

标签不会显示在浏览器中

来自分类Dev

我的 s3 存储桶中的图像不会在浏览器中打开,它们只会下载

来自分类Dev

CSS Active Class不会在浏览器中得到尊重吗?

来自分类Dev

CSS内联块不会以链接形式显示在浏览器中

来自分类Dev

在浏览器中存储CSS类

来自分类Dev

UCWeb 浏览器中的 CSS 问题

来自分类Dev

浏览器不会呈现添加CSS类的信息

来自分类Dev

并非所有自动化测试都在不同的浏览器中运行相同

来自分类Dev

DIV中的DIV将不会显示在浏览器中

来自分类Dev

Firefox不会在浏览器中显示日志

来自分类Dev

XML文档中的错误,浏览器将不会显示

来自分类Dev

Firefox不会在浏览器中显示日志

来自分类Dev

选择框在浏览器中不会令人失望

来自分类Dev

JavaScript不会更新浏览器中的文档

来自分类Dev

离子服务不会在浏览器中呈现

来自分类Dev

找不到文件,尽管它们存在

来自分类Dev

找不到文件,尽管它们存在

来自分类Dev

Chrome不会要求您记住密码

来自分类Dev

Android CSS 问题:每个浏览器中的 fantom 白色覆盖(可缩放和可触摸)非常奇怪

来自分类Dev

<normal> .css不会重置<html>元素在任何浏览器中的默认边距或填充率吗?

来自分类Dev

浏览器不要求字体文件

来自分类Dev

HornetQ 中的 JBoss EAP 6.4 集群,尽管它们在不同的盒子中

来自分类Dev

App Engine“ InvalidURLError:无效的请求URL”,尽管该URL在浏览器中工作正常

来自分类Dev

Hangfire没有运行任务,尽管它们在数据库中

来自分类Dev

每个浏览器有单独的缓存?

来自分类Dev

RewritePath不会更改浏览器URL

来自分类Dev

浏览器动作高度不会重置

Related 相关文章

  1. 1

    Laravel 7:浏览器可以看到已编译的CSS文件,但不会应用它们

  2. 2

    浏览器中的javascript要求

  3. 3

    标签不会显示在浏览器中

  4. 4

    我的 s3 存储桶中的图像不会在浏览器中打开,它们只会下载

  5. 5

    CSS Active Class不会在浏览器中得到尊重吗?

  6. 6

    CSS内联块不会以链接形式显示在浏览器中

  7. 7

    在浏览器中存储CSS类

  8. 8

    UCWeb 浏览器中的 CSS 问题

  9. 9

    浏览器不会呈现添加CSS类的信息

  10. 10

    并非所有自动化测试都在不同的浏览器中运行相同

  11. 11

    DIV中的DIV将不会显示在浏览器中

  12. 12

    Firefox不会在浏览器中显示日志

  13. 13

    XML文档中的错误,浏览器将不会显示

  14. 14

    Firefox不会在浏览器中显示日志

  15. 15

    选择框在浏览器中不会令人失望

  16. 16

    JavaScript不会更新浏览器中的文档

  17. 17

    离子服务不会在浏览器中呈现

  18. 18

    找不到文件,尽管它们存在

  19. 19

    找不到文件,尽管它们存在

  20. 20

    Chrome不会要求您记住密码

  21. 21

    Android CSS 问题:每个浏览器中的 fantom 白色覆盖(可缩放和可触摸)非常奇怪

  22. 22

    <normal> .css不会重置<html>元素在任何浏览器中的默认边距或填充率吗?

  23. 23

    浏览器不要求字体文件

  24. 24

    HornetQ 中的 JBoss EAP 6.4 集群,尽管它们在不同的盒子中

  25. 25

    App Engine“ InvalidURLError:无效的请求URL”,尽管该URL在浏览器中工作正常

  26. 26

    Hangfire没有运行任务,尽管它们在数据库中

  27. 27

    每个浏览器有单独的缓存?

  28. 28

    RewritePath不会更改浏览器URL

  29. 29

    浏览器动作高度不会重置

热门标签

归档