# oxc-css-parser
[](https://crates.io/crates/oxc-css-parser)
[](https://docs.rs/oxc-css-parser)
`oxc-css-parser` parses CSS, SCSS, Sass, and Less. It produces an AST and does not compile preprocessor syntax to CSS.
## Example
```rust
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`](https://github.com/oxc-project/oxc-css-parser/tree/main/crates/oxc_css_parser/examples).
For detailed API documentation, see [docs.rs](https://docs.rs/oxc-css-parser).
## Benchmark
The benchmark suite compares parser performance against other CSS parsers.
Install `cargo-criterion`, then add CSS files to a local `bench_data` directory:
```sh
cargo install cargo-criterion
cargo criterion
```
## Credits
Tests come from:
- [Web Platform Tests](https://github.com/web-platform-tests/wpt)
- [SWC CSS parser](https://github.com/swc-project/swc/tree/main/crates/swc_css_parser/tests)
- [ESBuild](https://github.com/evanw/esbuild/blob/master/internal/css_parser/css_parser_test.go)
- [Sass Spec Suite](https://github.com/sass/sass-spec)
- [Less Test Suite](https://github.com/less/less.js/tree/master/packages/test-data)
## License
MIT License
Copyright (c) 2022-present Pig Fang