SASS映像CSS缓存清除(通过罗盘) [英] SASS Image CSS Cache Busting (via Compass)

查看:226
本文介绍了SASS映像CSS缓存清除(通过罗盘)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以解释在SASS中实现缓存无效化的最佳实践方法吗?意思是,在我的CSS的编译,它附加一个时间戳到图像文件。例如,

Can anyone explain a best practice approach to implementing a cache buster in SASS? Meaning, on 'compilation' of my CSS, it appends a timestamp to images files. E.g.,

以下SASS代码:

!sprite="gubs.gif"

ul
  li.selected
    :background
      :image= image_url(!sprite)
      :repeat no-repeat
      :position= "right" -222px

应产生:

ul li.selected {
  background: url(../images/gubs.gif?123456789) no-repeat right -222px
}

在ruby工具juicer中,这是自动完成的。但我似乎找不到关于如何在Sass中通过指南针这样做的文档。

In the ruby tool juicer, this is automatically done for you. But I can't seem to find documentation on how to do this in SASS, via Compass.

推荐答案

确保你使用指南针v0.6.5或更高版本。

Make sure you are using compass v0.6.5 or greater.

此外,您还需要确保您已将 images_dir 您的配置文件相对于您的项目根目录,并设置 http_images_path =:relative

Also, you'll need to make sure you have the images_dir set in your configuration file relative to your project root directory and set http_images_path = :relative.

,它仍然不工作,最好的地方得到支持是罗盘邮件列表。

Once you have done all that, and it's still not working, the best place to get support is the compass mailing list.

这篇关于SASS映像CSS缓存清除(通过罗盘)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆