Crate rsass

Source
Expand description

Sass reimplemented in rust (not yet complete).

The “r” in the name might stand for the Rust programming language, for “re-implemented”, or possibly for my name Rasmus.

§Example

use rsass::{compile_scss_path, output};

let path = "tests/misc/14_imports/a.scss".as_ref();
let format = output::Format {
    style: output::Style::Compressed,
    .. Default::default()
};
let css = compile_scss_path(path, format).unwrap();

assert_eq!(css, b"div span{moo:goo}\n")

§Sass language and implemetation status

The sass language is defined in its reference doc. This implementation is incomplete but getting there, if slowly.

Progress: 5988 of 13041 tests passed.

If you want a working rust library for sass right now, you may be better of with sass-rs or sass-alt, which are rust wrappers around libsass. Another alternative is grass which is another early stage pure rust implementation. That said, this implementation has reached a version where I find it usable for my personal projects, and the number of working tests are improving.

Modules§

css
Types for css values and rules.
input
Finding and loading files.
output
Types describing how to format output.
sass
Value and Item types (and some supporting) for sass.
value
Types used in sass and css values.

Structs§

ParseError
An error encountered when parsing sass.
Scope
Variables, functions and mixins are defined in a Scope.

Enums§

Error
Many functions in rsass that returns a Result uses this Error type.
Invalid
Something invalid.
ScopeError
Tried to get something that does not exist from a scope.
ScopeRef
A static or dynamic scope referece.

Functions§

compile_scss
Parse scss data from a buffer and write css in the given style.
compile_scss_path
Parse a file of scss data and write css in the given style.
compile_value
Parse a scss value from a buffer and write its css representation in the given format.
parse_value_data
Parse a scss value.