【发布时间】:2020-03-13 22:37:58
【问题描述】:
我正在尝试使用 Jekyll 构建的 webfonts。字体在本地正确显示,但当推送到实时环境时,字体不显示。每种字体缺失都会出现Failed to load resource: the server responded with a status of 404 () 的控制台错误。
_site 目录是这样设置的:
assets/css/style.css
fonts/ <-- all my .woff files are in here
index.html
index.html 文件中引用了 CSS 文件,如下所示:
<link rel="stylesheet" href="{{ '/assets/css/style.css' | relative_url }}">
@font-face 声明是这样的:
@font-face {
font-family: 'My font';
src: url('../../fonts/myfont.woff2') format('woff2'),
url('../../fonts/myfont.woff') format('woff');
}
我是否需要在 _config.yml 文件中声明某些内容才能正常工作?
【问题讨论】:
标签: html css fonts jekyll webfonts