[][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::{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: 1645 of 3440 tests for sass 3.6 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

css
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.

SassFunction

A function that can be called from a sass value.

Enums

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.

OutputStyle

Selected target format. Only formats that are variants of this type are supported by rsass.

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 scss data from a buffer and write css in the given style.

parse_scss_data

Parse scss data from a buffer.

parse_scss_file

Parse a scss file.

parse_value_data

Parse a scss value.

set_precision

Set how many digits of precision to use when outputting decimal numbers.

Type Definitions

Rational

Alias for a Ratio of machine-sized integers.