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: 5565 of 7637 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

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

Structs

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

Enums

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

Functions