我正在使用 Grunt-Contrib-Sass,但我似乎无法在任何地方找到 config.rb 文件(如果它正在创建一个)。我需要它来为 http_fonts_path 分配一个路径,因为我正在使用 Compass 字体-face mixin,它似乎正在返回字体路径“./fonts”
这是混合代码:
@import "compass/css3";
@include font-face("Tw Cen MT", font-files("..fonts/tw_cen_mt/Tw_Cen_MT-webfont.woff", "..fonts/tw_cen_mt/Tw_Cen_MT-webfont.ttf", "..fonts/tw_cen_mt/Tw_Cen_MT-webfont.svg"), "..fonts/tw_cen_mt/Tw_Cen_MT-webfont.eot");
@include font-face("New Cicle Gordita", font-files("..fonts/new_cicle_gordita/New_Cicle_Gordita-webfont.woff", "..fonts/new_cicle_gordita/New_Cicle_Gordita-webfont.ttf", "..fonts/new_cicle_gordita/New_Cicle_Gordita-webfont.svg"), "..fonts/new_cicle_gordita/New_Cicle_Gordita-webfont.eot");
现在这是我得到的警告:
WARNING: 'Tw_Cen_MT-webfont.woff' was not found (or cannot be read) in ./fonts/..fonts/tw_cen_mt
WARNING: 'Tw_Cen_MT-webfont.ttf' was not found (or cannot be read) in ./fonts/..fonts/tw_cen_mt
WARNING: 'Tw_Cen_MT-webfont.svg' was not found (or cannot be read) in ./fonts/..fonts/tw_cen_mt
WARNING: 'Tw_Cen_MT-webfont.eot' was not found (or cannot be read) in ./fonts/..fonts/tw_cen_mt
WARNING: 'Tw_Cen_MT-webfont.eot?' was not found (or cannot be read) in ./fonts/..fonts/tw_cen_mt
WARNING: 'New_Cicle_Gordita-webfont.woff' was not found (or cannot be read) in ./fonts/..fonts/new_cicle_gordita
WARNING: 'New_Cicle_Gordita-webfont.ttf' was not found (or cannot be read) in ./fonts/..fonts/new_cicle_gordita
WARNING: 'New_Cicle_Gordita-webfont.svg' was not found (or cannot be read) in ./fonts/..fonts/new_cicle_gordita
WARNING: 'New_Cicle_Gordita-webfont.eot' was not found (or cannot be read) in ./fonts/..fonts/new_cicle_gordita
WARNING: 'New_Cicle_Gordita-webfont.eot?' was not found (or cannot be read) in ./fonts/..fonts/new_cicle_gordita
不用说在css文件中的输出和warning是一样的,不是我原来放在sass文件中的mixin。
但是,当我使用没有“..”的路径时,它可以正常工作,并且不会将“./fonts”添加到url。
@include font-face("Tw Cen MT", font-files("/tw_cen_mt/Tw_Cen_MT-webfont.woff", "/tw_cen_mt/Tw_Cen_MT-webfont.ttf", "/tw_cen_mt/Tw_Cen_MT-webfont.svg"), "/tw_cen_mt/Tw_Cen_MT-webfont.eot");
@include font-face("New Cicle Gordita", font-files("/new_cicle_gordita/New_Cicle_Gordita-webfont.woff", "/new_cicle_gordita/New_Cicle_Gordita-webfont.ttf", "/new_cicle_gordita/New_Cicle_Gordita-webfont.svg"), "/new_cicle_gordita/New_Cicle_Gordita-webfont.eot");
但是,这不是我想要在我的 CSS 文件中生成的 url。