在流星中使用font-face?

son*_*olo 10 fonts font-face meteor

我试图在流星中使用CSS @ font-face,但由于某种原因它不起作用:

@font-face {
    font-family: printFailed; 
    src:
    url("../public/fonts/wlm_print_failed.ttf"),
    url("../public/fonts/wlm_print_failed.eot");
}
Run Code Online (Sandbox Code Playgroud)

我检查了我的路径和拼写.

当我在浏览器中检查元素时,看起来文件路径和名称是正确的,但浏览器替换了通用字体而不是预期的自定义字体.

有什么指针吗?谢谢.

Aks*_*hat 27

从Web浏览器的角度来看,只需将/所有内容用作public根目录:

@font-face {
    font-family: printFailed; 
    src:
    url("/fonts/wlm_print_failed.ttf"),
    url("/fonts/wlm_print_failed.eot");
}
Run Code Online (Sandbox Code Playgroud)

  • 在部分Sass文件或Sass文件中使用`@ font-face`规则对我不起作用.我必须将规则放在`/ public/fonts`中的css文件中,并将它们链接到名为`/ client/main_head.html`的文件中的`link`标签中; 该文件只有一个`head`标签和里面的`link`标签(Meteor首先在名称中加载`head`文件). (2认同)