Crate grass_compiler

source ·
Expand description

This crate provides functionality for compiling Sass to CSS.

This crate targets compatibility with the reference implementation in Dart. If upgrading from the now deprecated libsass, one may have to modify their stylesheets. These changes will not differ from those necessary to upgrade to dart-sass, and in general such changes should be quite rare.

This crate is capable of compiling Bootstrap 4 and 5, bulma and bulma-scss, Bourbon, as well as most other large Sass libraries with complete accuracy. For the vast majority of use cases there should be no perceptible differences from the reference implementation.

§Use as library

fn main() -> Result<(), Box<grass::Error>> {
    let css = grass::from_string(
        "a { b { color: &; } }".to_owned(),
        &grass::Options::default().style(grass::OutputStyle::Compressed)
    )?;
    assert_eq!(css, "a b{color:a b}");
    Ok(())
}

§Use as binary

cargo install grass
grass input.scss

Re-exports§

Modules§

Structs§

  • A function implemented in rust that is accessible from within Sass
  • SassErrors can be either a structured error specific to grass or an io::Error.
  • A file system implementation that acts like it’s completely empty.
  • Configuration for Sass compilation
  • Use std::fs to read any files from disk.
  • Evaluation context of the current execution

Enums§

Traits§

  • A trait to allow replacing the file system lookup mechanisms.

Functions§

Type Aliases§