Class Sass::CSS
In: lib/sass/css.rb
Parent: Object

This class contains the functionality used in the +css2sass+ utility, namely converting CSS documents to Sass templates.

Methods

new   render  

Public Class methods

Creates a new instance of Sass::CSS that will compile the given document to a Sass string when render is called.

[Source]

    # File lib/sass/css.rb, line 93
93:     def initialize(template)
94:       if template.is_a? IO
95:         template = template.read
96:       end
97: 
98:       @template = StringScanner.new(template)
99:     end

Public Instance methods

Processes the document and returns the result as a string containing the CSS template.

[Source]

     # File lib/sass/css.rb, line 103
103:     def render
104:       begin
105:         build_tree.to_sass
106:       rescue Exception => err
107:         line = @template.string[0...@template.pos].split("\n").size
108:         
109:         err.backtrace.unshift "(css):#{line}"
110:         raise err
111:       end
112:     end

[Validate]