From 794703fbc4f0799f620969eb8d9eb8b5c070b310 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 9 Oct 2010 13:27:48 -0700 Subject: [PATCH] Make it easier to disable the asset cache buster. --- .../tutorials/configuration-reference.markdown | 4 ++++ lib/compass/configuration/data.rb | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc-src/content/tutorials/configuration-reference.markdown b/doc-src/content/tutorials/configuration-reference.markdown index d62b89b7..ff6807d2 100644 --- a/doc-src/content/tutorials/configuration-reference.markdown +++ b/doc-src/content/tutorials/configuration-reference.markdown @@ -260,3 +260,7 @@ that points to the asset on disk — which may or may not exist. "v=#{deploy_version}" end end + +To disable the asset cache buster: + + asset_cache_buster :none diff --git a/lib/compass/configuration/data.rb b/lib/compass/configuration/data.rb index 8ae6afa2..c2f88dd0 100644 --- a/lib/compass/configuration/data.rb +++ b/lib/compass/configuration/data.rb @@ -77,9 +77,19 @@ module Compass # If the block accepts two arguments, it will also be passed a File object # that points to the asset on disk -- which may or may not exist. # When called without a block, returns the block that was previously set. - def asset_cache_buster(&block) + # + # To disable the asset cache buster: + # + # asset_cache_buster :none + def asset_cache_buster(simple = nil, &block) if block_given? @asset_cache_buster = block + elsif !simple.nil? + if simple == :none + @asset_cache_buster = Proc.new {|_,_| nil} + else + raise ArgumentError, "Unexpected argument: #{simple.inspect}" + end else if @asset_cache_buster @asset_cache_buster