Skip to content

Commit

Permalink
Log ExecJS error in server mode for users with old Node.js
Browse files Browse the repository at this point in the history
  • Loading branch information
tdreyno committed Mar 9, 2019
1 parent f3366f6 commit e94eb1b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 14 additions & 9 deletions lib/middleman-autoprefixer/extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def initialize(app, options = {}, &block)

def after_configuration
# Setup Rack middleware to apply prefixes
app.use Rack, options
app.use Rack, config: options, middleman_app: @app
end

# Rack middleware to look for CSS and apply prefixes.
Expand All @@ -33,16 +33,18 @@ class Rack
# @param [Hash] options
def initialize(app, options = {})
@app = app
@inline = options[:inline]
@ignore = options[:ignore]
@middleman_app = options.fetch(:middleman_app)
@config = options.fetch(:config)
@inline = @config[:inline]
@ignore = @config[:ignore]

@processor = ::AutoprefixerRails::Processor.new({
browsers: options[:browsers] && Array(options[:browsers]),
add: options[:add],
remove: options[:remove],
grid: options[:grid],
supports: options[:supports],
flexbox: options[:flexbox]
browsers: @config[:browsers] && Array(@config[:browsers]),
add: @config[:add],
remove: @config[:remove],
grid: @config[:grid],
supports: @config[:supports],
flexbox: @config[:flexbox]
})
end

Expand Down Expand Up @@ -79,6 +81,9 @@ def process(response, type, path)

def prefix(content, path = nil)
@processor.process(content, path ? { from: path } : {}).css
rescue => e
@middleman_app.logger.error(e.message)
raise e
end

def prefix_inline_styles(content)
Expand Down
2 changes: 1 addition & 1 deletion lib/middleman-autoprefixer/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Middleman
module Autoprefixer
VERSION = '2.10.0'.freeze
VERSION = '2.10.1'.freeze
end
end

0 comments on commit e94eb1b

Please sign in to comment.