From 64f2f360ec9c27aa9c7545d8ab4678c0af3eaa6c Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 19 Jan 2017 11:37:48 +0000 Subject: Add encoding line to Ruby files Fixes https://github.com/mysociety/alavetelitheme/issues/69. --- lib/alavetelitheme.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/alavetelitheme.rb') diff --git a/lib/alavetelitheme.rb b/lib/alavetelitheme.rb index c245617..668d92a 100644 --- a/lib/alavetelitheme.rb +++ b/lib/alavetelitheme.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- theme_name = File.split(File.expand_path("../..", __FILE__))[1] theme_name.gsub!('-', '_') THEME_NAME = theme_name -- cgit v1.2.3 From ed5bc5dd15ad7722d97b1c3164a670298d2501e0 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 22 Mar 2017 13:32:37 +0000 Subject: Move assets to app/assets Latest version of assets:precompile task requires path to match app/assets: https://github.com/rails/sprockets-rails/blob/v2.3.3/lib/sprockets/railtie.rb#L60-L62 --- lib/alavetelitheme.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/alavetelitheme.rb') diff --git a/lib/alavetelitheme.rb b/lib/alavetelitheme.rb index 668d92a..0658142 100644 --- a/lib/alavetelitheme.rb +++ b/lib/alavetelitheme.rb @@ -39,6 +39,7 @@ $alaveteli_route_extensions << 'custom-routes.rb' ['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 -- cgit v1.2.3 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