25 unstable releases (11 breaking)
Uses new Rust 2024
| new 0.12.2 | Jan 15, 2026 |
|---|---|
| 0.11.2 | Jan 14, 2026 |
| 0.11.1 | Aug 20, 2025 |
| 0.11.0 | Jul 16, 2025 |
| 0.1.0 | Sep 25, 2022 |
#152 in Web programming
10,499 downloads per month
Used in 14 crates
(4 directly)
580KB
15K
SLoC
Raffia
Raffia is a parser which can parse CSS, SCSS, Sass (indented syntax) and Less. However, it won't compile SCSS, Sass or Less to CSS.
๐งช Playground
There is an online playground for inspecting AST. Visit: https://raffia-play.vercel.app/.
๐ญ Example
use raffia::{ast::Stylesheet, Parser, Syntax};
let mut parser = Parser::new("a { color: green }", Syntax::Css);
let ast = parser.parse::<Stylesheet>().unwrap();
println!("{:#?}", ast);
You can find more examples in the examples directory.
For detailed usage, check out docs.rs.
โ Benchmark
You can compare performance with other parsers in benchmark.
First, you need to setup Rust and clone this repository. You also need to install cargo-criterion by running cargo install cargo-criterion.
Then, copy some CSS files to bench_data directory. You need to create that directory by yourself.
Now you can run benchmark by running cargo criterion.
โจ Credit
Tests come from:
๐ License
MIT License
Copyright (c) 2022-present Pig Fang
Dependencies
~220โ740KB
~17K SLoC