Prepend custom assets to CONSUL assets
Rails 5 changed the initialization order, and now our initializers were running before the `append_assets_path` initializer for each engine, which prepended application assets to the custom assets we prepended in the initializer. Moving the code to the `config.after_initialize` code didn't work either, since the paths added there were ignored by the application. Adding another initializer to the Rails Engine is a hack, but solves the problem.
This commit is contained in:
committed by
Julian Herrero
parent
58b9899406
commit
4adf712c26
@@ -71,4 +71,14 @@ module Consul
|
||||
end
|
||||
end
|
||||
|
||||
class Rails::Engine
|
||||
initializer :prepend_custom_assets_path, group: :all do |app|
|
||||
if self.class.name == "Consul::Application"
|
||||
%w[images fonts javascripts].each do |asset|
|
||||
app.config.assets.paths.unshift(Rails.root.join("app", "assets", asset, "custom").to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
require "./config/application_custom.rb"
|
||||
|
||||
Reference in New Issue
Block a user