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
module Middleman::Extensions
module Middleman
module Extensions
# The Cache Buster extension
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))
http_path
else
begin
prefix = images_dir if prefix == http_images_path
rescue
if respond_to?(:http_images_path) && prefix == http_images_path
prefix = images_dir
end
real_path_static = File.join(prefix, path)
@ -55,9 +55,9 @@ module Middleman::Extensions
if !resource.template?
http_path << "?" + File.mtime(resource.source_file).strftime("%s")
else
# It's a template, possible with partials. We can't really know when
# it's updated, so generate fresh cache buster every time durin
# developement
# It's a template, possible with partials. We can't really
# know when it's updated, so generate fresh cache buster every
# time during developement
http_path << "?" + Time.now.strftime("%s")
end
end
@ -67,7 +67,5 @@ module Middleman::Extensions
end
end
end
# Register the extension
# register :cache_buster, CacheBuster
end
end