#css #sass #web #scss #internal

grass_compiler

Internal implementation of the grass compiler

6 releases

0.13.2 Feb 7, 2024
0.13.0 Jul 9, 2023
0.12.4 May 12, 2023
0.12.3 Feb 18, 2023
0.12.1 Jan 8, 2023

#1668 in Web programming

Download history 3206/week @ 2024-01-01 3956/week @ 2024-01-08 3791/week @ 2024-01-15 3658/week @ 2024-01-22 4136/week @ 2024-01-29 4285/week @ 2024-02-05 3256/week @ 2024-02-12 3438/week @ 2024-02-19 4015/week @ 2024-02-26 4791/week @ 2024-03-04 3830/week @ 2024-03-11 3705/week @ 2024-03-18 4019/week @ 2024-03-25 4324/week @ 2024-04-01 4240/week @ 2024-04-08 3863/week @ 2024-04-15

16,850 downloads per month
Used in 26 crates (3 directly)

MIT license

1MB
23K SLoC

grass_compiler

This crate exposes the internals of the main package, grass. For most users, the preferred crate should be grass, as it is more stable and has a simpler API.

This crate will see frequent breaking changes.

Documentation
crates.io


lib.rs:

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

Dependencies

~3.5MB
~60K SLoC