oxc-css-parser 0.0.1

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::{ast::Stylesheet, Parser, Syntax};

let mut parser = Parser::new("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 add CSS files to a local bench_data directory:

cargo install cargo-criterion
cargo criterion

Credits

Tests come from:

License

MIT License

Copyright (c) 2022-present Pig Fang