San*_*hah 7 css-sprites compass-sass
使用指南针当我试图创建一个精灵时,screen.css中主精灵图像的路径出错了,因为我无法看到图像.
我的scss代码是
@import "compass";
@import "spr/*.png";
h1 { @include spr-sprite("car"); height:50px; width:50px; }
Run Code Online (Sandbox Code Playgroud)
我的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;
}
Run Code Online (Sandbox Code Playgroud)
你可以看到背景不应该开始,../而不是直接开始/images/.它造成了一个问题.我的图像文件夹路径
images
------spr
---*.png
sass
-----screen.scss
css
---screen.css
Run Code Online (Sandbox Code Playgroud)
我的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"
Run Code Online (Sandbox Code Playgroud)
我是sass和指南针的新手,所以可能我错过了一些代码.请帮我找出来.任何帮助将不胜感激.非常感谢提前回复.
ste*_*eax 11
将此添加到您的config.rb:
relative_assets = true
Run Code Online (Sandbox Code Playgroud)
(我假设您没有从域的根目录提供此服务,否则就不需要它.您是否通过file://?查看页面?)
| 归档时间: |
|
| 查看次数: |
3615 次 |
| 最近记录: |