Class: Sass::CSS

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

new(template, options = {})

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 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

### Public Instance methods

render()

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

[Source]

         # 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

[Validate]