用于添加斜杠的SASS字体目录路径的config.rb

用于添加斜杠的SASS字体目录路径的config.rb,sass,compass-sass,Sass,Compass Sass,我已经将config.rb文件设置如下 http_path = "/" css_dir = "" sass_dir = "sass" images_dir = "images" fonts_dir = 'fonts' fonts_path = "" javascripts_dir = "js" 这是我的目录路径 在项目根目录中 style.css 字体/我的字体 sass/style.sass 图像/我的所有图像 现在,当我尝试使用字体面添加字体时,它会为字体目录添加前导斜杠,如/font,但

我已经将config.rb文件设置如下

http_path = "/"
css_dir = ""
sass_dir = "sass"
images_dir = "images"
fonts_dir = 'fonts'
fonts_path = ""
javascripts_dir = "js"
这是我的目录路径

在项目根目录中

style.css 字体/我的字体 sass/style.sass 图像/我的所有图像

现在,当我尝试使用字体面添加字体时,它会为字体目录添加前导斜杠,如
/font
,但我只需要
字体

无礼

生成CSS

@font-face {
  font-family: "Ubuntu";
  src: url('/fonts/ubuntu/ubuntu-r-webfont.eot') format('embedded-opentype'), url('/fonts/ubuntu/ubuntu-r-webfont.eot?#iefix') format('embedded-opentype'), url('/fonts/ubuntu/ubuntu-r-webfont.woff') format('woff'), url('/fonts/ubuntu/ubuntu-r-webfont.ttf') format('truetype'), url('/fonts/ubuntu/ubuntu-r-webfont.svg#ubunturegular') format('svg');
}

您可以在配置文件中的路径设置之后立即设置
relative_assets=true

下面是一个处理相关资产的配置示例

# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "app/css"
sass_dir = "app/css/sass"
images_dir = "app/img"
javascripts_dir = "app/js"
fonts_dir = "app/css/fonts"

output_style = :nested
environment = :development

relative_assets = true
可能重复的
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "app/css"
sass_dir = "app/css/sass"
images_dir = "app/img"
javascripts_dir = "app/js"
fonts_dir = "app/css/fonts"

output_style = :nested
environment = :development

relative_assets = true
You can set http_fonts_path = "fonts" right after path setting in config file.

Here is a sample config example to work.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "scss"
images_dir = "images"
javascripts_dir = "js"
http_fonts_path = "fonts"