Skip to content

Commit

Permalink
fix(js): allow pinning importmaps with gem (#49)
Browse files Browse the repository at this point in the history
Since import maps JSPM and the javascript ecosystem are a mess in their current state, allow import maps to match the assets served by the gem rather than download them from JSPM.
  • Loading branch information
mhenrixon authored Feb 15, 2024
1 parent 8df4575 commit 1dfffc8
Showing 1 changed file with 8 additions and 0 deletions.
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

0 comments on commit 1dfffc8

Please sign in to comment.