Late last year, the author came up with the idea for a novel CSS compressor called cssfact. This program takes CSS input and outputs compressed CSS with fewer rules. The level of compression can be adjusted based on the desired number of rules. The program only affects style rules and leaves non-style rules untouched. The author provides a link to the source code for those interested in trying it out. The program operates through binary matrix factorization in Boolean algebra, which allows for dimensionality reduction. Although the Boolean BMF problem is NP-hard, approximate decompositions still produce interpretable binary matrices. The author believes that this tool could have practical applications for managing and optimizing CSS codebases.
https://blog.danieljanus.pl/2024/01/26/lossy-css-compression/