#css #sass #web #scss #internal

grass_compiler

Internal implementation of the grass compiler

7 releases

0.13.3 May 19, 2024
0.13.2 Feb 7, 2024
0.13.0 Jul 9, 2023
0.12.4 May 12, 2023
0.12.1 Jan 8, 2023

#1615 in Web programming

Download history 3284/week @ 2024-02-15 3608/week @ 2024-02-22 3920/week @ 2024-02-29 4638/week @ 2024-03-07 3810/week @ 2024-03-14 3862/week @ 2024-03-21 4542/week @ 2024-03-28 3983/week @ 2024-04-04 4069/week @ 2024-04-11 3897/week @ 2024-04-18 4044/week @ 2024-04-25 4570/week @ 2024-05-02 4794/week @ 2024-05-09 4314/week @ 2024-05-16 3754/week @ 2024-05-23 3410/week @ 2024-05-30

17,064 downloads per month
Used in 29 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

~2.5–3.5MB
~60K SLoC