SASS Image CSS Cache Busting (via Compass)

时光毁灭记忆、已成空白 提交于 2020-01-01 19:50:30

问题


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.,

The following SASS code:

!sprite="gubs.gif"

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

Should produce:

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

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.


回答1:


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

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.



来源:https://stackoverflow.com/questions/975996/sass-image-css-cache-busting-via-compass

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!