From 63fb199fa9de45fa6fa35ee5fa7c62dc9e234e58 Mon Sep 17 00:00:00 2001 From: Denny de la Haye <2021@denny.me> Date: Fri, 7 May 2021 17:18:54 +0100 Subject: [PATCH 1/2] Try to flush out any cached CSS assets, to get new colours picked up everywhere --- plugins/ShinyCMS/config/initializers/assets.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ShinyCMS/config/initializers/assets.rb b/plugins/ShinyCMS/config/initializers/assets.rb index 6d4163174..c9ff1b083 100644 --- a/plugins/ShinyCMS/config/initializers/assets.rb +++ b/plugins/ShinyCMS/config/initializers/assets.rb @@ -7,7 +7,7 @@ # ShinyCMS is free software; you can redistribute it and/or modify it under the terms of the GPL (version 2 or later) # Version of your assets, change this if you want to expire all your assets. -Rails.application.config.assets.version = '2021.02.14.0800' +Rails.application.config.assets.version = '2021.05.07.1700' # Add node_modules directory to the asset load path. # Rails.application.config.assets.paths << Rails.root.join( 'node_modules' ) From 76f5c1e993d2258b471d864d15dfbd230e29171c Mon Sep 17 00:00:00 2001 From: Denny de la Haye <2021@denny.me> Date: Fri, 7 May 2021 19:19:16 +0100 Subject: [PATCH 2/2] Add theme CSS to asset precompile config --- plugins/ShinyCMS/config/initializers/assets.rb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/plugins/ShinyCMS/config/initializers/assets.rb b/plugins/ShinyCMS/config/initializers/assets.rb index c9ff1b083..bd64817d0 100644 --- a/plugins/ShinyCMS/config/initializers/assets.rb +++ b/plugins/ShinyCMS/config/initializers/assets.rb @@ -24,11 +24,23 @@ def available_themes end def add_theme_to_asset_load_path( theme_name ) + add_theme_images_to_asset_load_path( theme_name ) + add_theme_styles_to_asset_load_path( theme_name ) +end + +def add_theme_images_to_asset_load_path( theme_name ) + images_dir = Rails.root.join "themes/#{theme_name}/images" + return unless Dir.exist? images_dir + + Rails.application.config.assets.paths << images_dir +end + +def add_theme_styles_to_asset_load_path( theme_name ) stylesheets_dir = Rails.root.join "themes/#{theme_name}/stylesheets" - images_dir = Rails.root.join "themes/#{theme_name}/images" + return unless Dir.exist? stylesheets_dir - Rails.application.config.assets.paths << stylesheets_dir if Dir.exist? stylesheets_dir - Rails.application.config.assets.paths << images_dir if Dir.exist? images_dir + Rails.application.config.assets.paths << stylesheets_dir + Rails.application.config.assets.precompile += %W[ #{theme_name}.css ] end add_all_themes_to_asset_load_path