</>PackageGraphPackageGraph

css-tree

npmv3.2.1

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

Safe to adopt

Yes — css-tree scores well across adoption, maintenance, weight, supply chain, and licensing. No download data reported for this package yet. Last published 188 days ago. 5 releases in the last 2 years.

  • ?Adoption: grade ?, Not reported by this registry.

    No download data reported for this package yet.

  • BMaintenance: grade B, Good.

    Last published 188 days ago. 5 releases in the last 2 years.

  • AWeight: grade A, Excellent.

    Pulls in 2 transitive packages, about 2.1 MB installed.

  • ASupply chain: grade A, Excellent.

    No install scripts, 2 maintainers, and a contained dependency surface.

  • ALicense: grade A, Excellent.

    MIT — permissive, with no copyleft found in the dependency tree.

Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.

Install cost

What you actually take on by adding css-tree to a project.

2
Direct dependencies

Runtime packages this one declares itself.

2
Total installed

Distinct packages in the full runtime tree, deduplicated the way a package manager would.

2.1 MB
Install size

Unpacked size of this package plus its entire runtime tree.

1
Tree depth

Longest resolved dependency chain below this package.

Licenses in the dependency tree

BSD-3-ClauseCC0-1.0

Every license you inherit by installing css-tree, not just its own. Check this before a legal review, not after.

Compatibility

Node.js
node ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0
Module format
ESM + CommonJS
TypeScript
No bundled types
Install scripts
None

Quick start

A usage example from the css-tree README.

import * as csstree from 'css-tree';

// parse CSS to AST
const ast = csstree.parse('.example { world: "!" }');

// traverse AST and modify it
csstree.walk(ast, (node) => {
    if (node.type === 'ClassSelector' && node.name === 'example') {
        node.name = 'hello';
    }
});

// generate CSS from AST
console.log(csstree.generate(ast));
Example truncated — see the full README.

css-tree vs the alternatives

Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.

PackageWeekly downloadsDependentsLicenseLast release
css-treethis page05MIT6 months ago
esprima77.6M5BSD-2-Clause1 day ago
sugarss01MIT1 day ago
@adobe/css-tools02MIT1 day ago
espree04BSD-2-Clause1 day ago
postcss249.3M7MIT1 day ago

Dependencies

Declared by css-tree v3.2.1. Runtime dependencies are installed with the package; dev dependencies are not.

Dev (7)

c8 ^11.0.0clap ^2.0.1esbuild ^0.27.3eslint ^8.50.0json-to-ast ^2.1.0mocha ^9.2.2rollup ^2.80.0

Used by

Popular packages that depend on css-tree.

Relationship graph

Dependencies (left) and dependents (right) of css-tree.

Frequently installed together

Release history

3 releases in the last two years, typically about 14 days apart.

Recent versions of css-tree
VersionPublishedSizeLicense
3.2.1latest6 months ago1.3 MBMIT
3.2.06 months ago1.3 MBMIT
3.1.01 year ago1.3 MBMIT
3.0.11 year ago1.3 MBMIT
3.0.02 years ago1.3 MBMIT
2.3.13 years ago1.1 MBMIT
2.3.03 years ago1.1 MBMIT
2.2.14 years ago1.1 MBMIT
2.2.04 years ago1.1 MBMIT
2.1.04 years ago1.1 MBMIT
2.0.44 years ago1.1 MBMIT
2.0.34 years ago1.1 MBMIT
2.0.24 years ago1.1 MBMIT
2.0.14 years ago1.0 MBMIT
2.0.04 years ago1.0 MBMIT

Overview

css-tree is an npm package that 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. It has 5 known dependents in the graph. The latest version is 3.2.1, released under the MIT license.

Who should use it

Teams working in the npm ecosystem who need 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 and value a focused solution.

When not to use it

Consider an alternative if you need to have first-class TypeScript types out of the box, or if a more actively-maintained option better fits your npm stack.

Pros

  • Clear open-source license (MIT).

Cons

  • No bundled TypeScript types (may require a separate @types package).

Auto-generated from collected registry metadata. No external claims are inferred.

Maintainers

Keywords

Frequently asked questions

Should I use css-tree?

Yes — css-tree scores well across adoption, maintenance, weight, supply chain, and licensing. No download data reported for this package yet. Last published 188 days ago. 5 releases in the last 2 years.

How do I install css-tree?

Run `npm install css-tree` to add css-tree to your npm project.

How many dependencies does css-tree have?

css-tree declares 9 direct dependencies and pulls in 2 packages in total once its runtime tree is resolved totalling about 2.1 MB on disk.

What license is css-tree released under?

css-tree is distributed under the MIT license. Its dependency tree also includes: BSD-3-Clause, CC0-1.0.

How popular is css-tree?

npm does not publish download counts. Within PackageGraph's crawl, 5 known packages depend on css-tree.

Is css-tree still maintained?

The most recent release of css-tree (v3.2.1) was published 6 months ago.

Does css-tree run install scripts?

No. css-tree does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.