Crate rsass[][src]

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::{compile_scss_path, output};

let path = "tests/basic/14_imports/a.scss".as_ref();
let format = output::Format {
    style: output::Style::Compressed,
    precision: 5,
};
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: 3371 of 5945 tests passed in dart-sass compatibility mode.

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

Value type for css values.

output

Types describing how to format output.

sass

Value and Item types (and some supporting) for sass.

selectors

This module contains types for the selectors of a rule.

value

Types used in sass and css values.

Structs

FsFileContext

A filesystem file context specifies where to find local files.

ParseError

An error encountered when parsing sass.

Scope

Variables, functions and mixins are defined in a Scope.

SourceName

The name of a scss source file.

SourcePos

A position in sass input.

Enums

Error

Most functions in rsass that returns a Result uses this Error type.

ScopeRef

A static or dynamic scope referece.

Traits

FileContext

A file context manages finding and loading files.

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_scss_data

Parse scss data from a buffer.

parse_scss_file

Parse a scss file.

parse_scss_path

Parse a scss file by path.

parse_value_data

Parse a scss value.