# csstree/csstree

A tool set for CSS including fast detailed parser, walker, generator and lexer based on W3C specs and browser implementations

Repository: https://github.com/csstree/csstree
Canonical: https://ross.abutalabs.com/products/csstree
Homepage: https://csstree.github.io/docs/
Language: JavaScript
License: MIT
License Family: permissive
Topics: css-parser, ast, css, fast, parser, lexer, walker, generator, w3c
Last push: 2026-03-05T14:58:51+00:00

## Health v2 (maintenance only)
Score: 73/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 70, release rhythm 61, longevity 100
- inputs: {"age_days": 3652, "days_push": 181, "days_rel": 181, "gap_med": 42.5, "n_releases_24m": 5}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2118, forks 129 (observed 2026-08-28T04:06:16.432696+00:00)

## What it is
CSSTree is a JavaScript tool set for CSS that includes a fast, detailed parser (CSS to AST), AST walker, generator (AST to CSS), and lexer for syntax validation based on W3C specs and browser implementations. It is designed for efficiency and spec compliance, focusing on CSS analysis and source-to-source transformation tasks.

## Use cases
- parse css into an ast
- validate css declaration values against w3c syntaxes
- traverse and transform css ast nodes
- generate css from an ast
- build a css minifier or optimizer
- analyze css in a build tool or framework compiler

## When to choose
- you need a fast, spec-compliant CSS parser with adjustable detail level
- you need tolerant error handling that preserves invalid content for later processing
- you are building CSS analysis, transformation, or minification tooling
- you need to validate CSS values against W3C and vendor-specific syntaxes

## When to avoid
- you only need simple string-level CSS minification without AST manipulation
- you need a full CSS linter with style rules out of the box
- you work in a non-JavaScript ecosystem

## Facets
- artifact type: library
- maturity: stable
- function: parser, serialization, developer-tools
- domain: web-development, frontend, parsers
- platform: cross-platform
- tags: css, ast, lexer, walker, code-generator, w3c-specs, css-validation, source-to-source-transform, nodejs, javascript

## Member repositories
- csstree/csstree (main) score 73

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:16.432696+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:53:02.945205+00:00, confidence not recorded.
  - readme: https://github.com/csstree/csstree (fetched 2026-08-28T04:06:16.432696+00:00, sha e885c91a1eac)
  - homepage: https://csstree.github.io/docs/ (fetched 2026-08-29T10:33:30.730444+00:00, sha 382e48eed095)
- Data as of 2026-08-30T08:39:29.467469+00:00.
