diff --git a/lib/alavetelitheme.rb b/lib/alavetelitheme.rb index 278b2f33..70d59234 100644 --- a/lib/alavetelitheme.rb +++ b/lib/alavetelitheme.rb @@ -15,16 +15,6 @@ def set_whatdotheyknow_view_paths alias :set_view_paths :set_whatdotheyknow_view_paths end -# Prepend the asset directories in this theme to the asset path: -['stylesheets', 'images', 'javascripts'].each do |asset_type| - theme_asset_path = File.join(File.dirname(__FILE__), - '..', - 'app', - 'assets', - asset_type) - Rails.application.config.assets.paths.unshift theme_asset_path -end - # Append individual theme assets to the asset path theme_asset_path = File.join(File.dirname(__FILE__), '..', @@ -50,6 +40,22 @@ def set_whatdotheyknow_view_paths ActiveSupport::Dependencies.autoload_once_paths.delete(path) end +def prepend_theme_assets + # Prepend the asset directories in this theme to the asset path: + ['stylesheets', 'images', 'javascripts'].each do |asset_type| + theme_asset_path = File.join(File.dirname(__FILE__), + '..', + 'app', + 'assets', + asset_type) + Rails.application.config.assets.paths.unshift theme_asset_path + end +end + +Rails.application.config.to_prepare do + prepend_theme_assets +end + # Monkey patch app code for patch in ['patch_mailer_paths.rb', 'controller_patches.rb',