A platform for community discussion. Free, open, simple.
DEV: Plugin scss errors should break precompile (#6974)
Penar Musarajd639cadb7a92
diff --git a/lib/discourse.rb b/lib/discourse.rbindex 8f621b838c5..d681ddb2dde 100644--- a/lib/discourse.rb+++ b/lib/discourse.rb@@ -105,6 +105,8 @@ module Discourseclass Deprecation < StandardError; end+ class ScssError < StandardError; end+def self.filters@filters ||= [:latest, :unread, :new, :read, :posted, :bookmarks]enddiff --git a/lib/stylesheet/compiler.rb b/lib/stylesheet/compiler.rbindex 8cba8e677bc..9f7b3b9bb0b 100644--- a/lib/stylesheet/compiler.rb+++ b/lib/stylesheet/compiler.rb@@ -6,16 +6,6 @@ module Stylesheetclass Compiler- def self.error_as_css(error, label)- error = error.message- error.gsub!("\n", '\A ')- error.gsub!("'", '\27 ')-- "#main { display: none; }- body { white-space: pre; }- body:before { font-family: monospace; content: '#{error}' }"- end-def self.compile_asset(asset, options = {})if Importer.special_imports[asset.to_s]diff --git a/lib/stylesheet/manager.rb b/lib/stylesheet/manager.rbindex 7beded7f1b2..0a77196e34d 100644--- a/lib/stylesheet/manager.rb+++ b/lib/stylesheet/manager.rb@@ -166,15 +166,11 @@ class Stylesheet::Managersource_map_file: source_map_filename)rescue SassC::SyntaxError => e-- # we do not need this reported as we will report it in the UI anyway- Rails.logger.info "Failed to compile #{@target} stylesheet: #{e.message}"-if %w{embedded_theme mobile_theme desktop_theme}.include?(@target.to_s)# no special errors for theme, handled in theme editor["", nil]else- [Stylesheet::Compiler.error_as_css(e, "#{@target} stylesheet"), nil]+ raise Discourse::ScssError, e.messageendenddiff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rakeindex 8575ca11dc9..0e2c6525dfe 100644--- a/lib/tasks/assets.rake+++ b/lib/tasks/assets.rake@@ -58,7 +58,8 @@ task 'assets:precompile:css' => 'environment' doSTDERR.puts "Compiling css for #{db} #{Time.zone.now}"beginStylesheet::Manager.precompile_css- rescue => PG::UndefinedColumn+ rescue PG::UndefinedColumn => e+ STDERR.puts "#{e.class} #{e.message}: #{e.backtrace.join("\n")}"STDERR.puts "Skipping precompilation of CSS cause schema is old, you are precompiling prior to running migrations."endend