2022-09-01 04:58:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module SplashScreenHelper
|
2024-02-16 06:16:54 -05:00
|
|
|
def self.raw_js
|
2022-09-01 04:58:48 -04:00
|
|
|
if Rails.env.development?
|
2024-02-16 06:16:54 -05:00
|
|
|
load_js
|
2022-09-01 04:58:48 -04:00
|
|
|
else
|
2024-02-16 06:16:54 -05:00
|
|
|
@loaded_js ||= load_js
|
|
|
|
end.html_safe
|
2022-09-01 04:58:48 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def self.load_js
|
|
|
|
File.read("#{Rails.root}/app/assets/javascripts/discourse/dist/assets/splash-screen.js").sub(
|
2023-07-31 11:49:27 -04:00
|
|
|
"//# sourceMappingURL=splash-screen.map",
|
2022-09-01 04:58:48 -04: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
|