Make it easier to disable the asset cache buster.

This commit is contained in:
Chris Eppstein 2010-10-09 13:27:48 -07:00
parent 12f4bc7a06
commit 794703fbc4
2 changed files with 15 additions and 1 deletions

View File

@ -260,3 +260,7 @@ that points to the asset on disk — which may or may not exist.
"v=#{deploy_version}" "v=#{deploy_version}"
end end
end end
To disable the asset cache buster:
asset_cache_buster :none

View File

@ -77,9 +77,19 @@ module Compass
# If the block accepts two arguments, it will also be passed a File object # 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. # 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. # 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? if block_given?
@asset_cache_buster = block @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 else
if @asset_cache_buster if @asset_cache_buster
@asset_cache_buster @asset_cache_buster