2022-03-21 09:28:52 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Be sure to restart your server when you modify this file.
|
|
|
|
|
|
|
|
# Enable the asset pipeline
|
|
|
|
Rails.application.config.assets.enabled = true
|
|
|
|
|
|
|
|
# Version of your assets, change this if you want to expire all your assets.
|
2023-11-28 05:28:40 -06:00
|
|
|
Rails.application.config.assets.version = "2-#{GlobalSetting.asset_url_salt}"
|
2022-03-21 09:28:52 -05:00
|
|
|
|
|
|
|
# Add additional assets to the asset load path.
|
|
|
|
Rails.application.config.assets.paths << "#{Rails.root}/config/locales"
|
|
|
|
Rails.application.config.assets.paths << "#{Rails.root}/public/javascripts"
|
|
|
|
|
|
|
|
# Precompile additional assets.
|
|
|
|
# application.js, application.css, and all non-JS/CSS in the app/assets
|
|
|
|
# folder are already added.
|
|
|
|
|
|
|
|
# explicitly precompile any images in plugins ( /assets/images ) path
|
|
|
|
Rails.application.config.assets.precompile += [
|
|
|
|
lambda do |filename, path|
|
|
|
|
path =~ %r{assets/images} && !%w[.js .css].include?(File.extname(filename))
|
|
|
|
end,
|
|
|
|
]
|
|
|
|
|
|
|
|
Rails.application.config.assets.precompile += %w[
|
|
|
|
break_string.js
|
|
|
|
service-worker.js
|
|
|
|
locales/i18n.js
|
2022-06-20 09:33:05 -05:00
|
|
|
scripts/discourse-test-listen-boot
|
2023-01-07 05:59:28 -06:00
|
|
|
]
|
2022-03-21 09:28:52 -05:00
|
|
|
|
2023-10-26 11:29:53 -05:00
|
|
|
Rails.application.config.assets.precompile << lambda do |logical_path, filename|
|
|
|
|
filename.start_with?(EmberCli.dist_dir) && EmberCli.assets.include?(logical_path)
|
|
|
|
end
|
2022-03-21 09:28:52 -05:00
|
|
|
|
|
|
|
# Precompile all available locales
|
|
|
|
unless GlobalSetting.try(:omit_base_locales)
|
|
|
|
Dir
|
|
|
|
.glob("#{Rails.root}/app/assets/javascripts/locales/*.js.erb")
|
|
|
|
.each do |file|
|
|
|
|
Rails
|
|
|
|
.application
|
|
|
|
.config
|
|
|
|
.assets
|
|
|
|
.precompile << "locales/#{file.match(/([a-z_A-Z]+\.js)\.erb$/)[1]}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# out of the box sprockets 3 grabs loose files that are hanging in assets,
|
|
|
|
# the exclusion list does not include hbs so you double compile all this stuff
|
|
|
|
Rails.application.config.assets.precompile.delete(Sprockets::Railtie::LOOSE_APP_ASSETS)
|
|
|
|
|
|
|
|
# We don't want application from node_modules, only from the root
|
|
|
|
Rails.application.config.assets.precompile.delete(%r{(?:/|\\|\A)application\.(css|js)$})
|
|
|
|
|
|
|
|
Discourse
|
|
|
|
.find_plugin_js_assets(include_disabled: true)
|
2023-10-26 11:29:53 -05:00
|
|
|
.each do |file|
|
|
|
|
Rails.application.config.assets.precompile << "#{file}.js" if file.end_with?("_extra")
|
|
|
|
end
|