Skip to content

Commit

Permalink
Allow app to opt out of precompiling actiontext js assets
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrunberg committed Nov 19, 2024
1 parent e7eee73 commit 9a0e2f2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions actiontext/lib/action_text/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Engine < Rails::Engine
config.eager_load_namespaces << ActionText

config.action_text = ActiveSupport::OrderedOptions.new
config.action_text.precompile_assets = true
config.action_text.attachment_tag_name = "action-text-attachment"
config.autoload_once_paths = %W(
#{root}/app/helpers
Expand All @@ -33,8 +34,10 @@ class Engine < Rails::Engine
end

initializer "action_text.asset" do
if Rails.application.config.respond_to?(:assets)
Rails.application.config.assets.precompile += %w( actiontext.js actiontext.esm.js trix.js trix.css )
config.after_initialize do |app|
if app.config.respond_to?(:assets) && app.config.action_text.precompile_assets
app.config.assets.precompile += %w( actiontext.js actiontext.esm.js trix.js trix.css )
end
end
end

Expand Down

0 comments on commit 9a0e2f2

Please sign in to comment.