1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Allow app to opt out of precompiling activestorage js assets (#43967)

This commit is contained in:
jlestavel 2022-01-18 18:19:30 +01:00 committed by GitHub
parent 32a82eb553
commit 2197814074
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 4 deletions

View file

@ -25,8 +25,8 @@ module ActionCable
initializer "action_cable.asset" do
config.after_initialize do |app|
if Rails.application.config.respond_to?(:assets) && app.config.action_cable.precompile_assets
Rails.application.config.assets.precompile += %w( actioncable.js actioncable.esm.js )
if app.config.respond_to?(:assets) && app.config.action_cable.precompile_assets
app.config.assets.precompile += %w( actioncable.js actioncable.esm.js )
end
end
end

View file

@ -30,6 +30,7 @@ module ActiveStorage
config.active_storage.analyzers = [ ActiveStorage::Analyzer::ImageAnalyzer::Vips, ActiveStorage::Analyzer::ImageAnalyzer::ImageMagick, ActiveStorage::Analyzer::VideoAnalyzer, ActiveStorage::Analyzer::AudioAnalyzer ]
config.active_storage.paths = ActiveSupport::OrderedOptions.new
config.active_storage.queues = ActiveSupport::InheritableOptions.new
config.active_storage.precompile_assets = true
config.active_storage.variable_content_types = %w(
image/png
@ -167,8 +168,10 @@ module ActiveStorage
end
initializer "active_storage.asset" do
if Rails.application.config.respond_to?(:assets)
Rails.application.config.assets.precompile += %w( activestorage activestorage.esm )
config.after_initialize do |app|
if app.config.respond_to?(:assets) && app.config.active_storage.precompile_assets
app.config.assets.precompile += %w( activestorage activestorage.esm )
end
end
end

View file

@ -1972,6 +1972,11 @@ Cable as part of your normal Rails server.
You can find more detailed configuration options in the
[Action Cable Overview](action_cable_overview.html#configuration).
#### `config.action_cable.precompile_assets`
Determines whether the Action Cable assets should be added to the asset pipeline precompilation. It
has no effect if Sprockets is not used. The default value is `true`.
### Configuring Active Storage
`config.active_storage` provides the following configuration options:
@ -2192,6 +2197,11 @@ The default value depends on the `config.load_defaults` target version:
| (original) | `false` |
| 7.0 | `true` |
#### `config.active_storage.precompile_assets`
Determines whether the Active Storage assets should be added to the asset pipeline precompilation. It
has no effect if Sprockets is not used. The default value is `true`.
### Configuring Action Text
#### `config.action_text.attachment_tag_name`