I'm bad at Ruby
This commit is contained in:
parent
a6e577b83a
commit
593cdb27aa
|
@ -69,7 +69,7 @@ module Middleman::Extensions
|
|||
dirpath = Pathname.new(File.dirname(path))
|
||||
|
||||
if path =~ /(^\/$)|(\.(htm|html|php|css|js)$)/
|
||||
body = ::Middleman.Util.extract_response_text(response)
|
||||
body = ::Middleman::Util.extract_response_text(response)
|
||||
|
||||
if body
|
||||
# TODO: This regex will change some paths in plan HTML (not in a tag) - is that OK?
|
||||
|
|
|
@ -52,7 +52,7 @@ module Middleman
|
|||
path = env["PATH_INFO"]
|
||||
|
||||
if (path.end_with?('.html') || path.end_with?('.php')) && @inline
|
||||
uncompressed_source = ::Middleman.Util.extract_response_text(response)
|
||||
uncompressed_source = ::Middleman::Util.extract_response_text(response)
|
||||
|
||||
minified = uncompressed_source.gsub(/(<style[^>]*>\s*(?:\/\*<!\[CDATA\[\*\/\n)?)(.*?)((?:(?:\n\s*)?\/\*\]\]>\*\/)?\s*<\/style>)/m) do |match|
|
||||
first = $1
|
||||
|
@ -67,7 +67,7 @@ module Middleman
|
|||
headers["Content-Length"] = ::Rack::Utils.bytesize(minified).to_s
|
||||
response = [minified]
|
||||
elsif path.end_with?('.css') && @ignore.none? {|ignore| path =~ ignore }
|
||||
uncompressed_source = extract_response_text(response)
|
||||
uncompressed_source = ::Middleman::Util.extract_response_text(response)
|
||||
minified_css = @compressor.compress(uncompressed_source)
|
||||
|
||||
headers["Content-Length"] = ::Rack::Utils.bytesize(minified_css).to_s
|
||||
|
|
|
@ -54,7 +54,7 @@ module Middleman
|
|||
|
||||
begin
|
||||
if (path.end_with?('.html') || path.end_with?('.php')) && @inline
|
||||
uncompressed_source = ::Middleman.Util.extract_response_text(response)
|
||||
uncompressed_source = ::Middleman::Util.extract_response_text(response)
|
||||
|
||||
minified = uncompressed_source.gsub(/(<script[^>]*>\s*(?:\/\/(?:(?:<!--)|(?:<!\[CDATA\[))\n)?)(.*?)((?:(?:\n\s*)?\/\/(?:(?:-->)|(?:\]\]>)))?\s*<\/script>)/m) do |match|
|
||||
first = $1
|
||||
|
@ -76,7 +76,7 @@ module Middleman
|
|||
headers["Content-Length"] = ::Rack::Utils.bytesize(minified).to_s
|
||||
response = [minified]
|
||||
elsif path.end_with?('.js') && @ignore.none? {|ignore| path =~ ignore }
|
||||
uncompressed_source = extract_response_text(response)
|
||||
uncompressed_source = ::Middleman::Util.extract_response_text(response)
|
||||
minified_js = @compressor.compress(uncompressed_source)
|
||||
|
||||
headers["Content-Length"] = ::Rack::Utils.bytesize(minified_js).to_s
|
||||
|
|
Loading…
Reference in a new issue