CSSTree is a tool set for CSS: fast detailed parser (CSS → AST), walker (AST traversal), generator (AST → CSS) and lexer (validation and matching) based on specs and browser implementations.
The main goal is to be efficient and W3C spec compliant, with focus on CSS analyzing and source-to-source transforming tasks.
This is free and open source software.
Key Features
- Detailed parsing with an adjustable level of detail – by default CSSTree parses CSS as detailed as possible, i.e. each single logical part is representing with its own AST node (see AST format for all possible node types).
- Tolerant to errors by design.
- Fast and efficient – created with focus on performance and effective memory consumption.
- Syntax validation – the built-in lexer can test CSS against syntaxes defined by W3C. CSSTree uses mdn/data as a basis for lexer’s dictionaries and extends it with vendor specific and legacy syntaxes. Lexer can only check the declaration values and at-rules currently, but this feature will be extended to other parts of the CSS in the future
Website: github.com/csstree/csstree
Support:
Developer: Roman Dvornov
License: MIT License
CSSTree is written in JavaScript. Learn JavaScript with our recommended free books and free tutorials.
Related Software
| CSS Parsers | |
|---|---|
| PostCSS | Transform styles with JavaScript plugins |
| Lightning CSS | Parser, transformer, bundler, and minifier |
| Rework | Plugin framework for CSS preprocessing |
| PHP CSS Parser | PHP library for reading CSS |
| Mensch | Non-validating CSS parser |
| CSSTree | Tool set for CSS |
| Stylis | Lightweight CSS preprocessor |
| tinycss2 | CSS parser and generator |
| Parse | Go library offering lexers, parsers, and parsing utilities |
| LibCSS | CSS parser and selection engine |
| Ruby CSS Parser | Load, parse and cascade CSS rule sets |
| ParserLib | CSS3 SAX-inspired parser |
| css-parser | Fork of the cssutils project |
| ph-css | Parse, represent, modify, and write CSS stylesheets |
| Stylecow | Modern CSS to all browsers |
| Gonzales PE | CSS parser which plays nicely with preprocessors |
| CSSOM | CSS parser written in pure JavaScript |
Read our verdict in the software roundup.
Explore our carefully curated directory of recommended free and open source software, covering every major software category.The directory forms part of our extensive collection of articles for Linux enthusiasts. It includes hundreds of detailed reviews, together with free and open source alternatives to proprietary software from companies such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. LinuxLinks also covers interesting projects worth exploring, Linux-compatible hardware, free programming books and tutorials, and much more. Know a useful free and open source Linux application that we haven’t covered? Tell us about it using our submission form. |


Please read our Comment Policy before commenting.