PHP Classes


Recommend this page to a friend!
  Classes of Jelle Sebreghts   PHP CSS Optimize   Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP CSS Optimize
Optimize CSS files removing redundant data
Author: By
Last change: Update
Added paypal donate button to README.
Date: 6 years ago
Size: 729 bytes


Class file image Download


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 paypal.