class Middleman::Extensions::AssetHash
def manipulate_single_resource(resource)
def manipulate_single_resource(resource) return unless @exts.include?(resource.ext) return if ignored_resource?(resource) return if resource.ignored? digest = if resource.binary? ::Digest::SHA1.file(resource.source_file).hexdigest[0..7] else # Render through the Rack interface so middleware and mounted apps get a shot response = @rack_client.get( Addressable::URI.encode(resource.destination_path), 'bypass_inline_url_rewriter_asset_hash' => 'true' ) raise "#{resource.path} should be in the sitemap!" unless response.status == 200 ::Digest::SHA1.hexdigest(response.body)[0..7] end path, basename, extension = split_path(resource.destination_path) resource.destination_path = options.rename_proc.call(path, basename, digest, extension, options) resource end