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