fix for static files

This commit is contained in:
Matthias Döring 2011-06-02 12:05:09 +02:00
parent a53983e56d
commit 36698f1aba

View file

@ -31,7 +31,11 @@ module Middleman
if env["PATH_INFO"].match(/\.html$/) if env["PATH_INFO"].match(/\.html$/)
compressor = ::Uglifier.new compressor = ::Uglifier.new
if response.is_a?(::Rack::File) or response.is_a?(Sinatra::Helpers::StaticFile)
uncompressed_source = File.read(response.path)
else
uncompressed_source = response.join uncompressed_source = response.join
end
minified = uncompressed_source.gsub(/(<scri.*?\/\/<!\[CDATA\[\n)(.*?)(\/\/\]\].*?<\/script>)/m) do |m| minified = uncompressed_source.gsub(/(<scri.*?\/\/<!\[CDATA\[\n)(.*?)(\/\/\]\].*?<\/script>)/m) do |m|
first = $1 first = $1