From e94eb1bcb5feed7888f9acdd4f82e54cf8a9db38 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Sat, 9 Mar 2019 10:42:17 -0800 Subject: [PATCH] Log ExecJS error in server mode for users with old Node.js --- lib/middleman-autoprefixer/extension.rb | 23 ++++++++++++++--------- lib/middleman-autoprefixer/version.rb | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/middleman-autoprefixer/extension.rb b/lib/middleman-autoprefixer/extension.rb index ed70786..8d5b5fc 100644 --- a/lib/middleman-autoprefixer/extension.rb +++ b/lib/middleman-autoprefixer/extension.rb @@ -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. @@ -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 @@ -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) diff --git a/lib/middleman-autoprefixer/version.rb b/lib/middleman-autoprefixer/version.rb index cc87cc4..69799d5 100644 --- a/lib/middleman-autoprefixer/version.rb +++ b/lib/middleman-autoprefixer/version.rb @@ -1,5 +1,5 @@ module Middleman module Autoprefixer - VERSION = '2.10.0'.freeze + VERSION = '2.10.1'.freeze end end