【发布时间】:2021-08-13 23:33:31
【问题描述】:
我刚刚升级到 laravel 8,需要使用字体建立一个网站。我已经下载了字体并将它们放在字体文件夹中的资源文件夹中。之后我将它们添加到我的css中,但它似乎不起作用。我错过了一步,是否需要先编译bij webpack?我做错了什么?
字体: https://fontsgeek.com/fonts/Jot-Regular https://fonts.google.com/specimen/Roboto
style.scss:
@font-face {
font-family: JotRegular;
src: local('/fonts/JotRegular.ttf');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: Roboto;
src: local('/fonts/Roboto-Regular.ttf');
font-weight: normal;
font-style: normal;
}
h2{
font-size: 2.2rem;
font-family: JotRegular;
}
【问题讨论】:
-
你用 npm 编译你的资产了吗?在开发过程中使用
npm run watch。
标签: laravel webpack sass fonts compilation