Exception: Sass::CompileError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/sass/exception.rb

Overview

An exception thrown because a Sass compilation failed.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#loaded_urls ⇒ Array<String> (readonly)

Returns:

  • (Array<String>)


13
14
15
# File 'lib/sass/exception.rb', line 13

def loaded_urls
  @loaded_urls
end

#sass_stack ⇒ String? (readonly)

Returns:

  • (String, nil)


7
8
9
# File 'lib/sass/exception.rb', line 7

def sass_stack
  @sass_stack
end

#span ⇒ Logger::SourceSpan? (readonly)

Returns:



10
11
12
# File 'lib/sass/exception.rb', line 10

def span
  @span
end

Instance Method Details

#to_css ⇒ String

Returns:

  • (String)


90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/sass/exception.rb', line 90

def to_css
  content = full_message(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        ordinal = match.ord\n        replacement = \"\\\\\#{ordinal.to_s(16)}\"\n        if match.length > 1\n          replacement << ' ' if ordinal < 0x100000\n          replacement << match[1]\n        end\n        replacement\n      end};\n    }\n  CSS\nend\n".freeze