From 45cb5bcf460afd0ed4ded6570e1b6d2a470312a1 Mon Sep 17 00:00:00 2001 From: achernyshev Date: Thu, 14 Apr 2016 17:58:16 +0300 Subject: [PATCH] fix sprockets engine registering for older sprocket-rails versions --- lib/css_splitter/engine.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/css_splitter/engine.rb b/lib/css_splitter/engine.rb index 2f50392..17122f3 100644 --- a/lib/css_splitter/engine.rb +++ b/lib/css_splitter/engine.rb @@ -1,8 +1,12 @@ module CssSplitter class Engine < ::Rails::Engine initializer 'css_splitter.sprockets_engine', after: 'sprockets.environment', group: :all do |app| - app.config.assets.configure do |assets| - assets.register_bundle_processor 'text/css', CssSplitter::SprocketsEngine + if app.config.assets.public_methods.include? :configure + app.config.assets.configure do |assets| + assets.register_bundle_processor 'text/css', CssSplitter::SprocketsEngine + end + else + app.assets.register_bundle_processor 'text/css', CssSplitter::SprocketsEngine end end