【问题标题】:Compass adding leading slash when generating sprite生成精灵时指南针添加前导斜线
【发布时间】:2013-03-06 00:14:28
【问题描述】:

我刚刚生成了一个带有指南针的精灵,但由于某种原因,它在生成的类 url 中添加了一个前导斜杠。是否可以覆盖它或者我的 config.rb 有什么问题?

感谢您的帮助。

乔

config.rb >

http_path = "/"
css_dir = "/"
sass_dir = "/"
images_dir = "img"
javascripts_dir = "js"

萨斯>

@import "spr/*.png";
@include all-spr-sprites;

生成的 CSS >

.spr-sprite, .spr-female, .spr-male {
  background: url('/img/spr-s88dfc99cac.png') no-repeat;
}

【问题讨论】:

    标签: sass compass-sass


    【解决方案1】:

    抱歉,我一发布问题,就在这里找到了另一个问题的答案...

    Compass throwing in forward slash in front of images when making sprites

    答案:

    默认情况下,罗盘对所有资产使用绝对路径。

    要更改此行为,请将此行添加到您的 config.rb:

    relative_assets = true
    

    否则,您还可以更改“http_path”选项以指向您的项目站点在部署服务器上的位置。

    【讨论】:

      猜你喜欢
      • 2013-04-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-21
      • 2012-06-11
      • 1970-01-01
      • 2013-02-11
      • 1970-01-01
      相关资源
      最近更新 更多