[][src]Crate rsass

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_file, output};

let file = "tests/basic/14_imports/a.scss".as_ref();
let format = output::Format {
    style: output::Style::Compressed,
    precision: 5,
};
let css = compile_scss_file(file, 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: 2320 of 5577 tests passed in dart-sass compatiblilty 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
output

Types describing how to format output.

sass
selectors

This module contains types for the selectors of a rule.

Structs

FileContext

A file context specifies where to find files to load.

GlobalScope

A Scope that can be created without allready having a scope as a parameter is a GlobalScope.

Number

The actual number part of a numeric sass or css value.

ParseError

An error encountered when parsing sass.

SassFunction

A function that can be called from a sass value.

Enums

Dimension
Error

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

Item

Every sass file is a sequence of sass items. Scoping items contains further sequences of items.

ListSeparator

The difference between a comma-separated and a whitespace-separated list.

Quotes

A literal value can be double-quoted, single-quoted or not quoted.

Unit

Units in css.

Traits

Scope

Variables, functions and mixins are defined in a Scope.

Functions

compile_scss

Parse scss data from a buffer and write css in the given style.

compile_scss_file

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_value_data

Parse a scss value.

Type Definitions

Rational

Alias for a Ratio of machine-sized integers.