我正在尝试使用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
文件中声明一些内容才能使其正常工作吗?