PHP code example of cerdic / css-tidy

1. Go to this page and download the library: Download cerdic/css-tidy library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cerdic / css-tidy example snippets



$csstidy = new csstidy();

// Set some options :
$csstidy->set_cfg('optimise_shorthands', 2);
$csstidy->set_cfg('template', 'high');

// Parse the CSS
$csstidy->parse($css_code);

// Get back the optimized CSS Code
$css_code_opt = $csstidy->print->plain();