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 .nil? highlight = Exception.respond_to?(:to_tty?) && Exception.to_tty? if highlight.nil? if highlight .dup else .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) " /* \#{content.gsub('*/', \"*\\u2060/\").gsub(\"\\r\\n\", \"\\n\").split(\"\\n\").join(\"\\n * \")} */\n\n body::before {\n position: static;\n display: block;\n padding: 1em;\n margin: 0 0 1em;\n border-width: 0 0 2px;\n border-bottom-style: solid;\n font-family: monospace, monospace;\n white-space: pre;\n content: \#{Serializer.serialize_quoted_string(content).gsub(/[^[:ascii:]][\\h\\t ]?/) do |match|\n replacement = \"\\\\\#{match.ord.to_s(16)}\"\n replacement << \" \#{match[1]}\" if match.length > 1\n replacement\n end};\n }\n CSS\nend\n".freeze |