【问题标题】:Cache busting with Compass sprite使用 Compass sprite 进行缓存破坏
【发布时间】:2013-03-29 03:46:10
【问题描述】:

我正在对指南针中的图像使用缓存清除:

asset_cache_buster do |http_path, real_path|
  if File.exists?(real_path)
    hash = Digest::MD5.file(real_path.path).hexdigest
    "v=%s" % hash[0,5]
  end
end

使用image_url() 将附加v

如何使用精灵完成相同的行为?:

@import '../images/navbar/*.png';
@include navbar-sprite;

我试过了,但抛出了罗盘语法错误:

@import image-url('../images/navbar/*.png');

我能做什么?

【问题讨论】:

    标签: sass compass-sass


    【解决方案1】:

    罗盘精灵的默认行为几乎是这样,除了它会更改文件名,而不是更改查询字符串。检查文件系统和/或输出 css。您没有看到生成的图像,其 URL 为 /images/navbar-s34fe0604ab.png?只要/images/navbar/ 中的任何文件发生更改,该名称就会更改。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-11-01
      • 1970-01-01
      • 2012-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多