CSS Demo

With the model classes you can create CSS definitions in memory. Here is an example: <?php
$sheet    
= new ADT_CSS_Sheet();
$sheet->addRule(
    new 
ADT_CSS_Rule(
        
'#rule-1',
        array(
            new 
ADT_CSS_Property'border''1px solid red' ),
            new 
ADT_CSS_Property'background-color''#EEE' )
        )
    )
);
$sheet->addRule(
    new 
ADT_CSS_Rule(
        
'#rule-2',
        array(
            new 
ADT_CSS_Property'font-size''1.2em' ),
            new 
ADT_CSS_Property'position''static' )
        )
    )
);
?>
The created Style Sheet contains 2 selectors now: which you can read with $sheet->getSelectors();
...
#rule-1 { border: 1px solid red; background-color: #EEE; } #rule-2 { font-size: 1.2em; position: static; }
Using the File_CSS_Compressor you can minimize: By calling File_CSS_Compressor::compressSheet( $sheet ); the compressed CSS will look like #rule-1{border:1px solid red;background-color:#EEE} #rule-2{font-size:1.2em;position:static}

Statistics:

Compressed 113B of source to 92B.
Compressed to 81.4%.
Compression ratio is 1.23 : 1.