我的指南针目录看起来是这样的:指南针@字体面无法找到字体文件
root_of_directory
sass
screen.scss
stylesheets
fonts
goudysto.ttf
screen.css
,然后混入的字体面看起来是这样的:
@include font-face("goudysto", font-files("goudysto.ttf", "truetype"));
输出在控制台中这样说:
GET file:///fonts/goudysto.ttf net::ERR_FILE_NOT_FOUND
这是输出的CSS
@font-face {
font-family: "goudysto";
src: url('/fonts/goudysto.ttf') format('truetype');
}
谁能告诉我为什么会发生这种情况?
*更新 - config.rb *
require 'compass/import-once/activate'
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "stylesheets"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"
fonts_dir = "stylesheets/fonts"
# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
# To disable debugging comments that display the original location of your selectors. Uncomment:
# line_comments = false
# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
它将'/'预先添加到您的URL中,这意味着字体文件没有找到,因为它在根目录中查找(如果项目位于项目文件夹中,那么根深于你的项目)。你有没有尝试删除开始的'/'? – somethinghere 2014-10-22 12:09:47
这是添加开始/自动。我不知道如何删除它。 – chap 2014-10-22 12:22:43
首先在实际的CSS文件中删除它,看看是否能解决它,然后至少你知道错误是什么方向。 – somethinghere 2014-10-22 12:25:05