Optimizes CSS (combines duplicate selectors, extracts duplicate css properties and values, minifies the css).
Render minified CSS:
$optimizer = new Jelle_S\CssOptimizer\CssOptimizer($css);
file_put_contents('style.min.css', $optimizer->renderMinifiedCSS());
Render SCSS from your css:
$optimizer = new Jelle_S\CssOptimizer\CssOptimizer($css);
file_put_contents('style.scss', $optimizer->renderSCSS());
This code is open source (GPL-3.0), however, if you like this class and you would like to sponsor the developer (me), feel free to .