CSSO (CSS Optimizer) is a CSS minifier that performs cleaning (removing redundancies), compression (replacing with shorter forms), and restructuring (merging declarations/rules) to reduce CSS file size. Version 5.0.5 (latest stable) supports ESM and CommonJS dual module, CSS Selectors Level 4, and ships TypeScript definitions. It is built on CSSTree for AST parsing and manipulation. Compared to other minifiers like clean-css, CSSO offers structural optimizations beyond simple compression. Maintained actively with frequent releases.
npm install cssoNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates two ways to use CSSO: simple minify() call and step-by-step AST compression via syntax module.
Use import syntax or ensure your project supports CommonJS with require('csso').Upgrade Node.js to ^12.20.0, ^14.13.0, or >=15.0.0.
npm install csso@latest
If relying on syntax API, consider using CSSTree directly.
Use const compressedAst = compress(ast).ast;
Import from 'csso/syntax' for step-by-step AST manipulation.
Use import or require('csso') which automatically resolves to CommonJS.Use import { minify } from 'csso';Update to csso@5.0.1 or later. npm install csso@latest