| Class | Sass::CSS |
| In: |
lib/sass/css.rb
|
| Parent: | Object |
Creates a new instance of Sass::CSS that will compile the given document to a Sass string when render is called.
# File lib/sass/css.rb, line 114
114: def initialize(template, options = {})
115: if template.is_a? IO
116: template = template.read
117: end
118:
119: @options = options
120: @template = StringScanner.new(template)
121: end
Processes the document and returns the result as a string containing the CSS template.
# File lib/sass/css.rb, line 125
125: def render
126: begin
127: build_tree.to_sass(@options).strip + "\n"
128: rescue Exception => err
129: line = @template.string[0...@template.pos].split("\n").size
130:
131: err.backtrace.unshift "(css):#{line}"
132: raise err
133: end
134: end