Sha256: e8fe6833763ea747c21dcd5e8bd9dcb9e6a009f7ae5268b70609d3fd236d063d

Contents?: true

Size: 652 Bytes

Versions: 1

Compression:

Stored size: 652 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
middleman-0.9.20 lib/middleman/features/cache_buster.rb