From f025f5c05852c6a847349c47ebbd2f1182181182 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 14 Sep 2017 17:20:30 +0100 Subject: Add extra theme assets to the asset path The new version of Sprockets for Rails 4.2 only adds assets from the base path so we need to add this ourselves. https://github.com/rails/sprockets-rails/blob/v3.2.0/lib/sprockets/railtie.rb#L84-L87 --- lib/alavetelitheme.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/alavetelitheme.rb') diff --git a/lib/alavetelitheme.rb b/lib/alavetelitheme.rb index 0658142..c472d34 100644 --- a/lib/alavetelitheme.rb +++ b/lib/alavetelitheme.rb @@ -45,6 +45,20 @@ $alaveteli_route_extensions << 'custom-routes.rb' 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__), + '..', + 'app', + 'assets') +theme_asset_path = Pathname.new(theme_asset_path).cleanpath.to_s + +LOOSE_THEME_ASSETS = lambda do |logical_path, filename| + filename.start_with?(theme_asset_path) && + !['.js', '.css', ''].include?(File.extname(logical_path)) +end + +Rails.application.config.assets.precompile.unshift(LOOSE_THEME_ASSETS) + # Tell FastGettext about the theme's translations: look in the theme's # locale-theme directory for a translation in the first place, and if # it isn't found, look in the Alaveteli locale directory next: -- cgit v1.2.3