Minor minify_javascript cleanup
This commit is contained in:
parent
2292c32773
commit
8bf0124241
|
@ -1,5 +1,6 @@
|
|||
# Extension namespace
|
||||
module Middleman::Extensions
|
||||
module Middleman
|
||||
module Extensions
|
||||
|
||||
# Minify Javascript Extension
|
||||
module MinifyJavascript
|
||||
|
@ -22,7 +23,7 @@ module Middleman::Extensions
|
|||
end
|
||||
|
||||
# Setup Rack middlware to minify JS
|
||||
use MinifyJavascriptRack, :compressor => chosen_compressor,
|
||||
use Rack, :compressor => chosen_compressor,
|
||||
:ignore => ignore,
|
||||
:inline => inline
|
||||
end
|
||||
|
@ -31,7 +32,7 @@ module Middleman::Extensions
|
|||
end
|
||||
|
||||
# Rack middleware to look for JS and compress it
|
||||
class MinifyJavascriptRack
|
||||
class Rack
|
||||
|
||||
# Init
|
||||
# @param [Class] app
|
||||
|
@ -96,9 +97,9 @@ module Middleman::Extensions
|
|||
response
|
||||
when Array
|
||||
response.join
|
||||
when Rack::Response
|
||||
when ::Rack::Response
|
||||
response.body.join
|
||||
when Rack::File
|
||||
when ::Rack::File
|
||||
File.read(response.path)
|
||||
else
|
||||
response.to_s
|
||||
|
@ -106,7 +107,5 @@ module Middleman::Extensions
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Register extension
|
||||
# register :minify_javascript, MinifyJavascript
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue