This project is a fork of g-plane/raffia for Oxfmt.
oxc-css-parser parses CSS, SCSS, Sass, and Less.
It produces an AST and does not compile preprocessor syntax to CSS.
How it parses, and why, is in AGENTS.md.
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.
Tests come from:
MIT License