Skip to content

Commit

Permalink
fix(js): allow pinning importmaps with gem (#51)
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 12, 2024
1 parent 4495476 commit 9f6c1cc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/turbo_boost/streams/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,20 @@
require_relative "patches"

class TurboBoost::Engine < ::Rails::Engine
config.turbo_boost_streams = ActiveSupport::OrderedOptions.new
config.turbo_boost_streams.precompile_assets = true

config.after_initialize do
::Turbo::Streams::TagBuilder.send :include, TurboBoost::Streams::Patches::TagBuilder
::Turbo::Streams::Broadcasts.send :include, TurboBoost::Streams::Patches::Broadcasts
::Turbo::Broadcastable.send :include, TurboBoost::Streams::Patches::Broadcastable
end

initializer "turbo_boost_streams.asset" do
config.after_initialize do |app|
if app.config.respond_to?(:assets) && app.config.turbo_boost_streams.precompile_assets
app.config.assets.precompile += %w[@turbo-boost/streams.js]
end
end
end
end

0 comments on commit 9f6c1cc

Please sign in to comment.