oxc-css-parser 0.0.3

Parser for CSS, SCSS, Sass, and Less.
Documentation

oxc-css-parser

Crates.io docs.rs

oxc-css-parser parses CSS, SCSS, Sass, and Less. It produces an AST and does not compile preprocessor syntax to CSS.

Example

use oxc_css_parser::{Allocator, Parser, Syntax, ast::Stylesheet};

let allocator = Allocator::default();
let mut parser = Parser::new(&allocator, "a { color: green }", Syntax::Css);
let ast = parser.parse::<Stylesheet>().unwrap();
println!("{:#?}", ast);

More examples are available in examples.

For detailed API documentation, see docs.rs.

Benchmark

The benchmark suite compares parser performance against other CSS parsers.

Install cargo-criterion, then run the checked-in fixture benchmark:

cargo install cargo-criterion
cargo criterion

To benchmark custom inputs, add CSS, SCSS, Sass, or Less files to a local bench_data directory. When bench_data contains supported files, it is used instead of the checked-in fixtures.

Credits

Tests come from:

License

MIT License