Minor cache_buster cleanup

This commit is contained in:
Thomas Reynolds 2012-04-26 16:02:06 -07:00
parent 4a49388d64
commit 2297100d9e

View file

@ -1,5 +1,6 @@
# Extension namespace # Extension namespace
module Middleman::Extensions module Middleman
module Extensions
# The Cache Buster extension # The Cache Buster extension
module CacheBuster module CacheBuster
@ -40,9 +41,8 @@ module Middleman::Extensions
if http_path.include?("://") || !%w(.css .png .jpg .jpeg .svg .svgz .js .gif).include?(File.extname(http_path)) if http_path.include?("://") || !%w(.css .png .jpg .jpeg .svg .svgz .js .gif).include?(File.extname(http_path))
http_path http_path
else else
begin if respond_to?(:http_images_path) && prefix == http_images_path
prefix = images_dir if prefix == http_images_path prefix = images_dir
rescue
end end
real_path_static = File.join(prefix, path) real_path_static = File.join(prefix, path)
@ -55,9 +55,9 @@ module Middleman::Extensions
if !resource.template? if !resource.template?
http_path << "?" + File.mtime(resource.source_file).strftime("%s") http_path << "?" + File.mtime(resource.source_file).strftime("%s")
else else
# It's a template, possible with partials. We can't really know when # It's a template, possible with partials. We can't really
# it's updated, so generate fresh cache buster every time durin # know when it's updated, so generate fresh cache buster every
# developement # time during developement
http_path << "?" + Time.now.strftime("%s") http_path << "?" + Time.now.strftime("%s")
end end
end end
@ -67,7 +67,5 @@ module Middleman::Extensions
end end
end end
end end
end
# Register the extension
# register :cache_buster, CacheBuster
end end