Skip to content

Commit a4704a6

Browse files
authored
Merge pull request #1112 from denny/fix/halcyonic-theme-accessibility
Tweak asset precompile config for themes
2 parents 07c875b + 76f5c1e commit a4704a6

File tree

1 file changed

+16
-4
lines changed
  • plugins/ShinyCMS/config/initializers

1 file changed

+16
-4
lines changed

plugins/ShinyCMS/config/initializers/assets.rb

+16-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# ShinyCMS is free software; you can redistribute it and/or modify it under the terms of the GPL (version 2 or later)
88

99
# Version of your assets, change this if you want to expire all your assets.
10-
Rails.application.config.assets.version = '2021.02.14.0800'
10+
Rails.application.config.assets.version = '2021.05.07.1700'
1111

1212
# Add node_modules directory to the asset load path.
1313
# Rails.application.config.assets.paths << Rails.root.join( 'node_modules' )
@@ -24,11 +24,23 @@ def available_themes
2424
end
2525

2626
def add_theme_to_asset_load_path( theme_name )
27+
add_theme_images_to_asset_load_path( theme_name )
28+
add_theme_styles_to_asset_load_path( theme_name )
29+
end
30+
31+
def add_theme_images_to_asset_load_path( theme_name )
32+
images_dir = Rails.root.join "themes/#{theme_name}/images"
33+
return unless Dir.exist? images_dir
34+
35+
Rails.application.config.assets.paths << images_dir
36+
end
37+
38+
def add_theme_styles_to_asset_load_path( theme_name )
2739
stylesheets_dir = Rails.root.join "themes/#{theme_name}/stylesheets"
28-
images_dir = Rails.root.join "themes/#{theme_name}/images"
40+
return unless Dir.exist? stylesheets_dir
2941

30-
Rails.application.config.assets.paths << stylesheets_dir if Dir.exist? stylesheets_dir
31-
Rails.application.config.assets.paths << images_dir if Dir.exist? images_dir
42+
Rails.application.config.assets.paths << stylesheets_dir
43+
Rails.application.config.assets.precompile += %W[ #{theme_name}.css ]
3244
end
3345

3446
add_all_themes_to_asset_load_path

0 commit comments

Comments
 (0)