From a50349845a20d070f7ac31599e31f356a8270a9b Mon Sep 17 00:00:00 2001 From: Jeffery Utter Date: Mon, 30 Dec 2013 11:54:14 -0600 Subject: [PATCH] after_build should be inside after_config to respect ordering of config.rb --- lib/middleman-imageoptim/extension.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/middleman-imageoptim/extension.rb b/lib/middleman-imageoptim/extension.rb index fbe6183..46fe1be 100644 --- a/lib/middleman-imageoptim/extension.rb +++ b/lib/middleman-imageoptim/extension.rb @@ -9,9 +9,14 @@ def registered(app, options_hash = {}, &block) options = Middleman::Imageoptim::Options.new(options_hash) yield options.user_options if block_given? - app.after_build {|builder| - Middleman::Imageoptim::Optimizer.new(app, builder, options).optimize! - } + app.after_configuration do + + app.after_build do |builder| + Middleman::Imageoptim::Optimizer.new(app, builder, options).optimize! + end + + end + end alias :included :registered end