使用指南针当我试图创建一个精灵时,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"