CSSO (CSS Optimizer) is a CSS minimizer that performs both minimization without changing the structure and structural minimization in order to get as little text as possible.
CSSO is written in Javascript and runs both in the browser and on the command line (using NodeJS).
Distributed under the MIT license.
What can
Minimization without changing the structure:
- Remove whitespace
- Removing the end ';'
- Delete comments
- Deleting invalid charset and import
- Removing erroneous items
- Minimization of color
- Minimize 0
- Minimize margin and padding
- Merging multi-line strings into single-line
- Font-weight minimization
Minimization with restructuring:
- Merging blocks with the same selectors
- Remove overlapping properties
- Partial selection of properties in a separate block
- Partial block merging
Where to find
References:
Attention : the project is in beta status and may contain flaws and errors. Most likely, the repository and hosting addresses for the web interface will change in the future. The announcement is intended to introduce the public with a new CSS minimizer at an early stage, collect feedback, correct missed errors and make CSSO easier for the user.
Why another minimizer
Most of today's popular minimizers (
YUICompressor and others like it) are minimization without parsing and analyzing the structure. Roughly speaking, a set of regexps replace X with a smaller Y.
Example:
.test { color: red }
.test { color: green }
Processing regexp'ami:
.test{color:red}.test{color:green}
Processing with structure minimization:
.test{color:green}
This is the difference. And if the benefits are not so obvious on small and manually minimized CSS, then on automatically created stylesheets, the gain can be kilobytes.
')
Ps. Documentation and even JsDoc in Russian. There will be English.