CSSO (CSS Optimizer) is a CSS minifier. It performs three sorts of transformations: cleaning (removing redundant), compression (replacement for the shorter forms), and restructuring (merge of declarations, rules, and so on). As a result, an output CSS becomes much smaller in size. One of CDN services like unpkg or jsDelivr can be used. By default (for short path) the ESM version is exposed. For IIFE version a full path to a bundle should be specified. CSSO is based on CSSTree to parse CSS into AST, AST traversal and to generate AST back to CSS. All CSSTree API is available behind syntax field extended with compress() method. You may minify CSS step by step. CSSO can use data about how CSS is used in the markup for better compression. File with this data (JSON) can be set using the usage option.
Features
- Bundles are available for use in a browser
- Minified IIFE with csso as global
- One of CDN services like unpkg or jsDelivr can be used
- Also syntax can be imported using csso/syntax entry point
- Minify source CSS passed as String
- Generate source map with respect of source map from input CSS