diff --git a/lib/turbo_boost/elements/engine.rb b/lib/turbo_boost/elements/engine.rb index 6a5b9a0..4985081 100644 --- a/lib/turbo_boost/elements/engine.rb +++ b/lib/turbo_boost/elements/engine.rb @@ -11,11 +11,19 @@ def self.config class Engine < ::Rails::Engine isolate_namespace TurboBoost::Elements + config.turbo_boost_elements = ActiveSupport::OrderedOptions.new + config.turbo_boost_elements.precompile_assets = true ActiveSupport.on_load(:action_controller_base) do # `self` is ActionController::Base helper TurboBoost::Elements::ApplicationHelper end + + config.after_initialize do |app| + if app.config.respond_to?(:assets) && app.config.turbo_boost_elements.precompile_assets + app.config.assets.precompile += %w[@turbo-boost/elements.js] + end + end end end