0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 12:09:27 +08:00
discourse/config/initializers/assets.rb
Jarek Radosz 48691ee582
DEV: Enable Rails/FilePath rubocop rule (#40097)
(to be enabled in the shared config)
2026-05-19 19:07:54 +02:00

31 lines
1.2 KiB
Ruby
Vendored

# 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.
Rails.application.config.assets.version = "2-#{GlobalSetting.asset_url_salt}"
# Add additional assets to the asset load path.
Rails.application.config.assets.paths.push(
"#{Rails.public_path.join("javascripts")}",
"#{Rails.root.join("frontend/discourse/dist/assets")}",
)
Rails.application.config.assets.paths.push(
*Discourse.plugins.map { |p| "#{Rails.root.join("app/assets/generated/#{p.directory_name}/")}" },
)
# These paths are added automatically by propshaft, but we don't want them
Rails.application.config.assets.excluded_paths.push(
"#{Rails.root.join("app/assets/generated")}",
"#{Rails.root.join("app/assets/javascripts")}",
"#{Rails.root.join("app/assets/stylesheets")}",
)
# We don't need/want most of Propshaft's preprocessing. Only keep the JS sourcemap handler
Rails.application.config.assets.compilers.filter! do |type, compiler|
type == "text/javascript" && compiler == Propshaft::Compiler::SourceMappingUrls
end