class Rainpress
Information¶ ↑
This is the main class of Rainpress
, create an instance of it to compress your CSS-styles.
- Author
-
Uwe L. Korn <uwelk@xhochy.org>
Options:
-
:comments
- if set to false, comments will not be removed -
:newlines
- if set to false, newlines will not be removed -
:spaces
- if set to false, spaces will not be removed -
:colors
- if set to false, colors will not be modified -
:misc
- if set to false, miscellaneous compression parts will be skipped
Public Class Methods
Quick-compress the styles. This eliminates the need to create an instance of the class
Public Instance Methods
Run the compressions and return the newly compressed text
Do miscellaneous compression methods on the style.
Remove all comments out of the CSS-Document
Only /* text */ comments are supported. Attention: If you are doing css hacks for IE using the comment tricks, they will be removed using this function. Please consider for IE css style corrections the usage of conditionals comments in your (X)HTML document.
Remove all newline characters
We take care of Windows(rn), Unix(n) and Mac(r) newlines.
Remove unneeded spaces
-
Turn mutiple spaces into a single
-
Remove spaces around ;:{},
-
Remove tabs
Replace color values with their shorter equivalent
-
Turn rgb(,,)-colors into -values
-
Shorten #AABBCC down to #ABC
-
Replace names with their shorter hex-equivalent
-
white -> fff
-
black -> #000
-
-
Replace -values with their shorter name
-
f00 -> red
-