added DONT_PRECOMPILE_CSS env var

This commit is contained in:
Sam 2015-10-13 10:48:21 +11:00
parent 42b72a9834
commit 25db4cc4d9

View File

@ -75,21 +75,25 @@ task 'assets:precompile:before' do
end
task 'assets:precompile:css' => 'environment' do
STDERR.puts "Start compiling CSS: #{Time.zone.now}"
if ENV["DONT_PRECOMPILE_CSS"] == "1"
STDERR.puts "Skipping CSS precompilation, ensure CSS lives in a shared directory across hosts"
else
STDERR.puts "Start compiling CSS: #{Time.zone.now}"
RailsMultisite::ConnectionManagement.each_connection do |db|
# Heroku precompiles assets before db migration, so tables may not exist.
# css will get precompiled during first request instead in that case.
RailsMultisite::ConnectionManagement.each_connection do |db|
# Heroku precompiles assets before db migration, so tables may not exist.
# css will get precompiled during first request instead in that case.
if ActiveRecord::Base.connection.table_exists?(ColorScheme.table_name)
STDERR.puts "Compiling css for #{db}"
[:desktop, :mobile, :desktop_rtl, :mobile_rtl].each do |target|
STDERR.puts "target: #{target} #{DiscourseStylesheets.compile(target)}"
if ActiveRecord::Base.connection.table_exists?(ColorScheme.table_name)
STDERR.puts "Compiling css for #{db}"
[:desktop, :mobile, :desktop_rtl, :mobile_rtl].each do |target|
STDERR.puts "target: #{target} #{DiscourseStylesheets.compile(target)}"
end
end
end
end
STDERR.puts "Done compiling CSS: #{Time.zone.now}"
STDERR.puts "Done compiling CSS: #{Time.zone.now}"
end
end
def assets_path