lib/juicer/css_cache_buster.rb in juicer-0.2.1 vs lib/juicer/css_cache_buster.rb in juicer-0.2.3
- old
+ new
@@ -34,14 +34,17 @@
#
# Update file. If no +output+ is provided, the input file is overwritten
#
def save(file, output = nil)
@contents = File.read(file)
+ used = []
urls(file).each do |url|
path = resolve(url, file)
+ next if used.include?(path)
if path != url
+ used << path
basename = File.basename(Juicer::CacheBuster.path(path))
@contents.sub!(url, File.join(File.dirname(url), basename))
end
end