1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00

Merge pull request #1526 from zamith/patch-1

Allow minify to correctly throw warnings
This commit is contained in:
Eliott Appleford 2015-05-19 16:43:35 +01:00
commit f2f82a4ff9

View file

@ -49,11 +49,11 @@ class Middleman::Extensions::MinifyJavascript < ::Middleman::Extension
status, headers, response = @app.call(env) status, headers, response = @app.call(env)
type = headers['Content-Type'].try(:slice, /^[^;]*/) type = headers['Content-Type'].try(:slice, /^[^;]*/)
path = env['PATH_INFO'] @path = env['PATH_INFO']
minified = if @inline && minifiable_inline?(type) minified = if @inline && minifiable_inline?(type)
minify_inline(::Middleman::Util.extract_response_text(response)) minify_inline(::Middleman::Util.extract_response_text(response))
elsif minifiable?(type) && !ignore?(path) elsif minifiable?(type) && !ignore?(@path)
minify(::Middleman::Util.extract_response_text(response)) minify(::Middleman::Util.extract_response_text(response))
end end
@ -94,7 +94,7 @@ class Middleman::Extensions::MinifyJavascript < ::Middleman::Extension
def minify(content) def minify(content)
@compressor.compress(content) @compressor.compress(content)
rescue ExecJS::ProgramError => e rescue ExecJS::ProgramError => e
warn "WARNING: Couldn't compress JavaScript in #{path}: #{e.message}" warn "WARNING: Couldn't compress JavaScript in #{@path}: #{e.message}"
content content
end end