SASS Image CSS Cache Busting (via Compass)

2019-04-16 03:35发布

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条回答
戒情不戒烟
2楼-- · 2019-04-16 04:21

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.

查看更多
登录 后发表回答