| Class | Sass::CSS |
| In: |
lib/sass/css.rb
|
| Parent: | Object |
This class converts CSS documents into Sass or SCSS templates. It works by parsing the CSS document into a {Sass::Tree} structure, and then applying various transformations to the structure to produce more concise and idiomatic Sass/SCSS.
Example usage:
Sass::CSS.new("p { color: blue }").render(:sass) #=> "p\n color: blue"
Sass::CSS.new("p { color: blue }").render(:scss) #=> "p {\n color: blue; }"
@param template [String] The CSS stylesheet.
This stylesheet can be encoded using any encoding
that can be converted to Unicode.
If the stylesheet contains an `@charset` declaration,
that overrides the Ruby encoding
(see {file:SASS_REFERENCE.md#encodings the encoding documentation})
@option options :old [Boolean] (false)
Whether or not to output old property syntax
(`:color blue` as opposed to `color: blue`).
This is only meaningful when generating Sass code,
rather than SCSS.