在这里使用指南针sass写下模板时,font-mixin在没有设置web字体的情况下会产生一些问题。我的配置文件就像
http_path = "/"
css_dir = "resources/stylesheets"
sass_dir = "resources/stylesheets"
images_dir = "resources/images"
javascripts_dir = "resources/js"
然后通过使用font mixin生成的输出是
@font-face {
font-family: "cabinregular";
src: url('resources/stylesheets/fonts/cabin-regular.eot?#iefix') format('embedded-
opentype'), url('resources/stylesheets/fonts/cabin-regular.ttf') format('truetype'),
url('resources/stylesheets/fonts/cabin-regular.woff') format('woff');
}
路径正确但运行html时字体不适用。但是如果我指定http路径
http_path="/somename/"
适用。那么为什么在没有指定http_path的情况下它将无法工作..?
答案 0 :(得分:3)
在主src之前引入src: url("../fonts/cabin-regular?#iefix");
使其正常工作
@font-face {
font-family: 'cabinregular';
src: url("../fonts/cabin-regular?#iefix");
src: url("../fonts/cabin-regular?#iefix") format("embedded-opentype"), url("../fonts/cabin-regular") format("woff"), url("../fonts/cabin-regular") format("truetype"), url("../fonts/cabin-regular.svg#cabin-regular") format("svg");
font-weight: normal;
font-style: normal;
}