2022-09-01 16:58:48 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module SplashScreenHelper
|
2024-02-16 19:16:54 +08:00
|
|
|
def self.raw_js
|
2022-09-01 16:58:48 +08:00
|
|
|
if Rails.env.development?
|
2024-02-16 19:16:54 +08:00
|
|
|
load_js
|
2022-09-01 16:58:48 +08:00
|
|
|
else
|
2024-02-16 19:16:54 +08:00
|
|
|
@loaded_js ||= load_js
|
|
|
|
end.html_safe
|
2022-09-01 16:58:48 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def self.load_js
|
|
|
|
File.read("#{Rails.root}/app/assets/javascripts/discourse/dist/assets/splash-screen.js").sub(
|
2023-07-31 23:49:27 +08:00
|
|
|
"//# sourceMappingURL=splash-screen.map",
|
2022-09-01 16:58:48 +08:00
|
|
|
"",
|
|
|
|
)
|
|
|
|
rescue Errno::ENOENT
|
|
|
|
Rails.logger.error("Unable to load splash screen JS") if Rails.env.production?
|
|
|
|
"console.log('Unable to load splash screen JS')"
|
|
|
|
end
|
|
|
|
end
|