Expand description
Sass reimplemented in rust with nom.
Sass reimplemented in rust with nom (early stage). The “r” in the name might stand for the Rust programming language, for “re-implemented”, or possibly for my name Rasmus.
Example
use rsass::{OutputStyle, compile_scss_file};
let file = "tests/basic/14_imports/a.scss".as_ref();
let css = compile_scss_file(file, OutputStyle::Compressed).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: of 3635 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 sassers 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
Structs
A file context specifies where to find files to load.
A
Scope
that can be created without allready having a scope as a
parameter is a GlobalScope
.The actual number part of a numeric sass or css value.
A function that can be called from a sass value.
Enums
Most functions in rsass that returns a Result uses this Error type.
Every sass file is a sequence of sass items.
Scoping items contains further sequences of items.
The difference between a comma-separated and a
whitespace-separated list.
Selected target format.
Only formats that are variants of this type are supported by rsass.
A literal value can be double-quoted, single-quoted or not quoted.
Units in css.
Traits
Variables, functions and mixins are defined in a
Scope
.Functions
Parse scss data from a buffer and write css in the given style.
Parse a file of scss data and write css in the given style.
Parse scss data from a buffer and write css in the given style.
Parse scss data from a buffer.
Parse a scss file.
Parse a scss value.
Set how many digits of precision to use when outputting decimal numbers.
Type Definitions
Alias for a
Ratio
of machine-sized integers.