Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(js): allow pinning importmaps with gem #49

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/turbo_boost/elements/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading