Exception: Sass::CompileError
- Inherits:
-
StandardError
- Object
- StandardError
- Sass::CompileError
- Defined in:
- lib/sass/exception.rb
Overview
An exception thrown because a Sass compilation failed.
Instance Attribute Summary collapse
- #loaded_urls ⇒ Array<String> readonly
- #sass_stack ⇒ String? readonly
- #span ⇒ Logger::SourceSpan? readonly
Instance Method Summary collapse
Instance Attribute Details
#loaded_urls ⇒ Array<String> (readonly)
13 14 15 |
# File 'lib/sass/exception.rb', line 13 def loaded_urls @loaded_urls end |
#sass_stack ⇒ String? (readonly)
7 8 9 |
# File 'lib/sass/exception.rb', line 7 def sass_stack @sass_stack end |
#span ⇒ Logger::SourceSpan? (readonly)
10 11 12 |
# File 'lib/sass/exception.rb', line 10 def span @span end |
Instance Method Details
#full_message(highlight: nil, order: nil) ⇒ String
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/sass/exception.rb', line 26 def (highlight: nil, order: nil, **) return super if @full_message.nil? highlight = Exception.respond_to?(:to_tty?) && Exception.to_tty? if highlight.nil? if highlight @full_message.dup else @full_message.gsub(/\e\[[0-9;]*m/, '') end end |
#to_css ⇒ String
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/sass/exception.rb', line 38 def to_css content = (highlight: false, order: :top) <<~CSS.freeze /* #{content.gsub('*/', "*\u2060/").gsub("\r\n", "\n").split("\n").join("\n * ")} */ body::before { position: static; display: block; padding: 1em; margin: 0 0 1em; border-width: 0 0 2px; border-bottom-style: solid; font-family: monospace, monospace; white-space: pre; content: #{Serializer.serialize_quoted_string(content).gsub(/[^[:ascii:]][\h\t ]?/) do |match| replacement = "\\#{match.ord.to_s(16)}" replacement << " #{match[1]}" if match.length > 1 replacement end}; } CSS end |