From 072089a9ce86321479b0a350b6ba580c27da558a Mon Sep 17 00:00:00 2001 From: Adrien Maston Date: Tue, 9 Dec 2025 10:26:56 +0100 Subject: [PATCH] stylesheet_paths is the only public method --- app/models/application_platform.rb | 33 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/app/models/application_platform.rb b/app/models/application_platform.rb index 274806f29..c484bf335 100644 --- a/app/models/application_platform.rb +++ b/app/models/application_platform.rb @@ -66,29 +66,30 @@ class ApplicationPlatform < PlatformAgent end end - def stylesheet_asset_name - case - when android_app? then "android" - when ios_app? then "ios" - else "desktop" - end - end - def stylesheet_paths scoped_stylesheet_paths("web") + (mobile_app? ? scoped_stylesheet_paths("mobile_app") : []) + scoped_stylesheet_paths(stylesheet_asset_name) end - def scoped_stylesheet_paths(scope = css_asset_name) - # Allow new stylesheets to be added in dev/test without restarting server + private + def stylesheet_asset_name + case + when android_app? then "android" + when ios_app? then "ios" + else "desktop" + end + end + + def scoped_stylesheet_paths(scope = css_asset_name) + # Allow new stylesheets to be added in dev/test without restarting server SCOPED_STYLESHEET_PATHS.clear if Rails.env.development? - SCOPED_STYLESHEET_PATHS[scope] ||= - Rails.root.join("app/assets/stylesheets").then do |stylesheet_root| - stylesheet_root.glob("#{scope}/**/*.css").collect do |path| - path.to_s.remove(stylesheet_root.to_s + "/", ".css") + SCOPED_STYLESHEET_PATHS[scope] ||= + Rails.root.join("app/assets/stylesheets").then do |stylesheet_root| + stylesheet_root.glob("#{scope}/**/*.css").collect do |path| + path.to_s.remove(stylesheet_root.to_s + "/", ".css") + end end - end - end + end end