タグ

2015年3月25日のブックマーク (2件)

  • Compass の asset_cache_buster で付けるパラメータを MD5ハッシュに変更する - Qiita

    デフォルトのままだとタイムスタンプが使われるので、複数人でコンパイル済みCSSをバージョン管理している場合に余計な差分が発生してしまう。 config.rbに以下を追加。 asset_cache_buster do |path, file| if File.file?(file.path) Digest::MD5.hexdigest(File.read(file.path))[0, 8] else $stderr.puts "WARNING: '#{File.basename(path)}' was not found (or cannot be read) in #{File.dirname(file.path)}" end end

    Compass の asset_cache_buster で付けるパラメータを MD5ハッシュに変更する - Qiita
  • Compassのasset_cache_busterでMD5を使う - Qiita

    Compassでimage-urlを使う場合に、画像が変更されたらキャッシュを読み込まずにきちんと表示が変わるように用意されているのがasset_cache_busterという仕組み。 ところがCompassのドキュメントに書かれている方法だと画像ファイルのタイムスタンプをGETパラメーターとして付ける形になるので、複数人で開発していると何度も変更が発生する。リポジトリからダウンロードしてきたタイミングにも依存してしまうし。 なのでファイルのMD5ハッシュを設定するようにする。config.rbに以下を追記。 # Increment the deploy_version before every release to force cache busting. deploy_version = 1 asset_cache_buster do |http_path, real_path| if

    Compassのasset_cache_busterでMD5を使う - Qiita