Packages:
lithron
csstidy


Classes:

Class csstidy_optimise


CSS Optimising Class

This class optimises CSS data generated by csstidy.

Author: Florian Schmitz (floele at gmail dot com) 2005-2006

Method Summary
string
compress_important ( &$string, string $string)
Removes unnecessary whitespace in ! important
string
compress_numbers ( string $subvalue)
Compresses numbers (ie. 1.0 becomes 1 or 1.100 becomes 1.1 )
string
cut_color ( string $color)
Color compression function. Converts all rgb() values to #-values and uses the short-form if possible. Also replaces 4 color names by #-values.
array
dissolve_4value_shorthands ( string $property, string $value)
Dissolves properties like padding:10px 10px 10px to padding-top:10px;padding-bottom:10px;...
array
dissolve_short_bg ( string $str_value)
Dissolve background property
array
explode_ws ( string $sep, string $string)
Explodes a string as explode() does, however, not if $sep is escaped or within a string.
array
merge_4value_shorthands ( array $array)
Merges Shorthand properties again, the opposite of dissolve_4value_shorthands()
array
merge_bg ( array $input_css)
Merges all background properties
array
merge_selectors ( &$array, array $array)
Merges selectors with same properties. Example: a{color:red} b{color:red} -> a,b{color:red} Very basic and has at least one bug. Hopefully there is a replacement soon.
void
Optimises $css after parsing
string
shorthand ( string $value)
Compresses shorthand values. Example: margin:1px 1px 1px 1px -> margin:1px
void
Optimises shorthands
void
Optimises a sub-value
void
value ()
Optimises values

Method Details

compress_important

public string compress_important ( &$string , string $string )

Removes unnecessary whitespace in ! important

Input
&$string
string$string
Output
Exception

compress_numbers

public string compress_numbers (string $subvalue )

Compresses numbers (ie. 1.0 becomes 1 or 1.100 becomes 1.1 )

Input
string$subvalue
Output
Exception

cut_color

public string cut_color (string $color )

Color compression function. Converts all rgb() values to #-values and uses the short-form if possible. Also replaces 4 color names by #-values.

Input
string$color
Output
Exception

dissolve_4value_shorthands

public array dissolve_4value_shorthands (string $property , string $value )

Dissolves properties like padding:10px 10px 10px to padding-top:10px;padding-bottom:10px;...

Input
string$property
string$value
Output
Exception

dissolve_short_bg

public array dissolve_short_bg (string $str_value )

Dissolve background property

Input
string$str_value
Output
Exception

explode_ws

public array explode_ws (string $sep , string $string )

Explodes a string as explode() does, however, not if $sep is escaped or within a string.

Input
string$sepseperator
string$string
Output
Exception

merge_4value_shorthands

public array merge_4value_shorthands (array $array )

Merges Shorthand properties again, the opposite of dissolve_4value_shorthands()

Input
array$array
Output
Exception

merge_bg

public array merge_bg (array $input_css )

Merges all background properties

Input
array$input_css
Output
Exception

merge_selectors

public array merge_selectors ( &$array , array $array )

Merges selectors with same properties. Example: a{color:red} b{color:red} -> a,b{color:red} Very basic and has at least one bug. Hopefully there is a replacement soon.

Input
&$array
array$array
Output
Exception

postparse

public void postparse ()

Optimises $css after parsing

Output
Exception

shorthand

public string shorthand (string $value )

Compresses shorthand values. Example: margin:1px 1px 1px 1px -> margin:1px

Input
string$value
Output
Exception

shorthands

public void shorthands ()

Optimises shorthands

Output
Exception

subvalue

public void subvalue ()

Optimises a sub-value

Output
Exception

value

public void value ()

Optimises values

Output
Exception