指南针生成精灵时添加前导斜杠 [英] Compass adding leading slash when generating sprite
问题描述
我刚刚用罗盘生成了一个精灵,但是由于某种原因,它在生成的类URL中添加了一个斜杠。
I have just generated a sprite with compass, but for some reason it is adding a leading slash in the generated class url. Is it possible to override this or is it something I have wrong in my config.rb?
感谢您的帮助。
Joe
config.rb>
config.rb >
http_path = "/"
css_dir = "/"
sass_dir = "/"
images_dir = "img"
javascripts_dir = "js"
>
sass >
@import "spr/*.png";
@include all-spr-sprites;
生成的CSS>
.spr-sprite, .spr-female, .spr-male {
background: url('/img/spr-s88dfc99cac.png') no-repeat;
}
推荐答案
应用发布问题,我在这里找到了另一个问题的答案...
Appologies, as soon as I posted the question I found the answer to another question here ...
答案:
默认情况下,指南针对所有资产使用绝对路径。
By default, compass uses absolute paths for all assets.
到更改此行为,将此行添加到您的config.rb中:
To change this behaviour, add this line to your config.rb:
relative_assets = true
否则,您也可以更改 http_path选项以指向您的项目站点在部署服务器上的位置。
Otherwise, you could also change the 'http_path' option to point to where your project sites on your deployment server.
这篇关于指南针生成精灵时添加前导斜杠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!