Class: Sass::CSS
Overview
Instance Method Summary collapse
-
#initialize(template, options = {}) ⇒ CSS
constructor
A new instance of CSS.
-
#render ⇒ String
Converts the CSS template into Sass code.
Constructor Details
#initialize(template, options = {}) ⇒ CSS
Returns a new instance of CSS.
65 66 67 68 69 70 71 72 |
# File 'lib/sass/css.rb', line 65 def initialize(template, = {}) if template.is_a? IO template = template.read end @options = @template = StringScanner.new(template) end |
Instance Method Details
#render ⇒ String
Converts the CSS template into Sass code.
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/sass/css.rb', line 77 def render begin build_tree.to_sass(0, @options).strip + "\n" rescue Exception => err line = @template.string[0...@template.pos].split("\n").size err.backtrace.unshift "(css):#{line}" raise err end end |