Sha256: 45ef8d8d3dfa9fe8cb3844a1271a00985a401a8d99233047068a2dc0260841bb

Contents?: true

Size: 576 Bytes

Versions: 10

Compression:

Stored size: 576 Bytes

Contents

class Middleman::Base
  alias_method :pre_cache_buster_asset_url, :asset_url
  helpers do
    def asset_url(path, prefix="")
      http_path = pre_cache_buster_asset_url(path, prefix)
      if http_path.include?("://") || !%w(.css .png .jpg .js .gif).include?(File.extname(http_path))
        http_path
      else
        real_path = File.join(self.class.environment == "build" ? options.build_dir : options.public, prefix, path)
        http_path << "?" + File.mtime(real_path).strftime("%s") if File.readable?(real_path)        
        http_path
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
middleman-0.9.17 lib/middleman/features/cache_buster.rb
middleman-0.9.16 lib/middleman/features/cache_buster.rb
middleman-0.9.15 lib/middleman/features/cache_buster.rb
middleman-0.9.14 lib/middleman/features/cache_buster.rb
middleman-0.9.13 lib/middleman/features/cache_buster.rb
middleman-0.9.12 lib/middleman/features/cache_buster.rb
middleman-0.9.11 lib/middleman/features/cache_buster.rb
middleman-0.9.10 lib/middleman/features/cache_buster.rb
middleman-0.9.9 lib/middleman/features/cache_buster.rb
middleman-0.9.8 lib/middleman/features/cache_buster.rb