CSSTree: CSS AST Parser, Walker, Generator, and Lexer
JSON →CSSTree is a comprehensive toolkit for processing CSS, providing a fast and detailed parser to transform CSS source into an Abstract Syntax Tree (AST), a walker for efficient AST traversal, a generator to serialize AST back into CSS, and a lexer for syntax validation and matching based on W3C specifications and browser implementations. The current stable version is 3.2.1, with frequent patch and minor releases indicating active development. It stands out for its performance (benchmarked as one of the fastest), spec compliance, detailed AST format with adjustable parsing levels, and inherent error tolerance by wrapping malformed content in `Raw` nodes instead of discarding it. It also leverages `mdn/data` for robust syntax validation, making it suitable for complex CSS analysis and source-to-source transformations.
Traffic · last 30 days ↓62% vs prev 7d
top countries 🇸🇬 Singapore · 🇺🇸 United States · 🇨🇦 Canada · 🇩🇪 Germany · CI