当我尝试使用 rake assets:precompile RAILS_ENV=production 时,它会抛出此错误:
Sass::SyntaxError: Invalid CSS after "...awesome-webfont": expected ")", was ".woff);"
这是我的style.css 文件:
@font-face {
font-family:FontAwesome;
src:font-image-url(fontawesome-webfont.woff);
}
如果我注释行 src:font-image-url(fontawesome-webfont.woff); 会出现此错误
Sass::SyntaxError: Invalid CSS after "...:image-url(ban2": expected ")", was ".jpg);"
我正在将 gem "font-awesome-rails" 与 rails 4.2.4 一起使用。
请您参考如下方法:
首先,您需要将您的网址用引号引起来。
其次,SASS 没有 URL helper 字体图像网址。您可能正在寻找执行以下操作的 font-url:
Generates a path to an asset found relative to the project's font directory.
应用上面的内容,你应该有类似的东西:
@font-face {
font-family: "FontAwesome";
src: font-url("fontawesome-webfont.woff");
}
第二个错误似乎是因为没有将 URL 值用引号引起来。






