class Middleman::Extensions::AssetHash
def manipulate_single_resource(resource)
def manipulate_single_resource(resource) return unless options.exts.include?(resource.ext) return if ignored_resource?(resource) return if resource.ignored? # Render through the Rack interface so middleware and mounted apps get a shot response = @rack_client.get( URI.escape(resource.destination_path), 'bypass_inline_url_rewriter_asset_hash' => 'true' ) raise "#{resource.path} should be in the sitemap!" unless response.status == 200 digest = Digest::SHA1.hexdigest(response.body)[0..7] resource.destination_path = resource.destination_path.sub(/\.(\w+)$/) { |ext| "-#{digest}#{ext}" } resource end