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 61
61:     def initialize(template)
62:       if template.is_a? IO
63:         template = template.read
64:       end
65: 
66:       @template = StringScanner.new(template)
67:     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 71
71:     def render
72:       begin
73:         build_tree.to_sass
74:       rescue Exception => err
75:         line = @template.string[0...@template.pos].split("\n").size
76:         
77:         err.backtrace.unshift "(css):#{line}"
78:         raise err
79:       end
80:     end

[Validate]