lib/propshaft/railtie.rb in propshaft-0.4.2 vs lib/propshaft/railtie.rb in propshaft-0.4.3
- old
+ new
@@ -1,9 +1,18 @@
require "rails"
require "rails/railtie"
require "active_support/ordered_options"
+# FIXME: There's gotta be a better way than this hack?
+class Rails::Engine < Rails::Railtie
+ initializer "propshaft.append_assets_path", group: :all do |app|
+ app.config.assets.paths.unshift(*paths["vendor/assets"].existent_directories)
+ app.config.assets.paths.unshift(*paths["lib/assets"].existent_directories)
+ app.config.assets.paths.unshift(*paths["app/assets"].existent_directories)
+ end
+end
+
module Propshaft
class Railtie < ::Rails::Railtie
config.assets = ActiveSupport::OrderedOptions.new
config.assets.paths = []
config.assets.prefix = "/assets"
@@ -31,15 +40,9 @@
if config.assets.sweep_cache
ActiveSupport.on_load(:action_controller_base) do
before_action { Rails.application.assets.load_path.cache_sweeper.execute_if_updated }
end
end
- end
-
- initializer "propshaft.append_assets_path" do |app|
- app.config.assets.paths.unshift(*paths["vendor/assets"].existent_directories)
- app.config.assets.paths.unshift(*paths["lib/assets"].existent_directories)
- app.config.assets.paths.unshift(*paths["app/assets"].existent_directories)
end
initializer "propshaft.logger" do
Propshaft.logger = config.assets.logger || Rails.logger
end