如何在 bower 包中使用 CSS 在 PhalconPHP 中加载字体?
How to load fonts in PhalconPHP with CSS in a bower package?
我正在尝试在 PhalconPHP 应用程序中加载 Roboto
google 字体。我已经使用 bower
安装了 roboto-fontface
,我正在尝试在我的 _fonts.scss
文件中使用 @font-face
在本地加载它的字体。
这是我的字体加载"code":
$roboto-font-path: '../../bower_components/roboto-fontface/fonts/roboto/';
@font-face {
font-family: "Roboto";
src: //local(Roboto Thin),
url("#{$roboto-font-path}Roboto-Thin.woff2") format("woff2"),
url("#{$roboto-font-path}Roboto-Thin.woff") format("woff");
font-weight: 100;
}
我使用的 url 似乎有效,但在检查 Firefox 中实际发生的情况时,我得到以下信息(这是我的 index.volt
的内容):
Screenshot of Firefox.
当然,我可以使用 <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
加载此字体,但这会影响将来使用多种字体时的加载时间。
有什么帮助吗?
每个 PhalconPHP 应用程序根目录中的 .htacces
将所有传入请求重定向到 public
目录。我的 bower_components
在这个目录之外。使用 .bowerrc
文件将 bower_components
移动到 public
目录中并修改了一些路径。现在像魅力一样工作¯_(ツ)_/¯。
我正在尝试在 PhalconPHP 应用程序中加载 Roboto
google 字体。我已经使用 bower
安装了 roboto-fontface
,我正在尝试在我的 _fonts.scss
文件中使用 @font-face
在本地加载它的字体。
这是我的字体加载"code":
$roboto-font-path: '../../bower_components/roboto-fontface/fonts/roboto/';
@font-face {
font-family: "Roboto";
src: //local(Roboto Thin),
url("#{$roboto-font-path}Roboto-Thin.woff2") format("woff2"),
url("#{$roboto-font-path}Roboto-Thin.woff") format("woff");
font-weight: 100;
}
我使用的 url 似乎有效,但在检查 Firefox 中实际发生的情况时,我得到以下信息(这是我的 index.volt
的内容):
Screenshot of Firefox.
当然,我可以使用 <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
加载此字体,但这会影响将来使用多种字体时的加载时间。
有什么帮助吗?
每个 PhalconPHP 应用程序根目录中的 .htacces
将所有传入请求重定向到 public
目录。我的 bower_components
在这个目录之外。使用 .bowerrc
文件将 bower_components
移动到 public
目录中并修改了一些路径。现在像魅力一样工作¯_(ツ)_/¯。