指南针 – 为什么我用罗盘精灵得到了错误的道路

使用指南针当我试图创建一个精灵时,screen.css中主精灵图像的路径出错了,因为我无法看到图像.

我的scss代码

@import "compass";
@import "spr/*.png";
 h1 { @include spr-sprite("car");  height:50px; width:50px; }

我的css输出为精灵

.spr-sprite,h1 {  background: url('/images/spr-sa37328aec0.png') no-repeat; }
h1 {  background-position: 0 -147px;  
height: 50px; 
width: 50px;
overflow: hidden; 
text-align: left; 

                  }

你可以看到背景不应该以../开头,而不是直接用/ images /开头.它造成了一个问题.
我的图像文件夹路径

images
 ------spr
          ---*.png
sass
-----screen.scss
css
---screen.css

我的config.rb代码

# 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"

我是sass和指南针的新手,所以可能我错过了一些代码.请帮我找出来.
任何帮助将不胜感激.非常感谢提前回复.

解决方法

将其添加到config.rb:
relative_assets = true

(我假设您不是从域的根目录提供此服务,否则就不需要它.您是否通过file://查看页面?)

相关文章

Css3如何实现鼠标移上变长特效?(图文+视频)
css3怎么实现鼠标悬停图片时缓慢变大效果?(图文+视频)
jquery如何实现点击网页回到顶部效果?(图文+视频)
css3边框阴影效果怎么做?(图文+视频)
css怎么实现圆角边框和圆形效果?(图文+视频教程)
Css3如何实现旋转移动动画特效