My favorites | Sign in
Project Logo
                
Feeds:
People details
Project owners:
  joe.scylla

cssmin reduces the size of stylesheet definitions by removing all unneeded whitespaces and comments.

Nothing special but has the same syntax as jsmin.

Requirements:

Syntax:

string cssmin::minify(string $css, mixed [$options])
  1. $css = stylesheet definitions as string.
  2. $options = array or comma separated list of options.

Options

  1. remove-last-semicolon: Removes the last semicolon in the style definition of an element (activated by default).
  2. preserve-urls: Preserves every url defined in an url()-expression. This option is only required if you have defined really uncommon urls with multiple spaces or combination of colon, semi-colon, braces with leading or following spaces.

Example:

include("cssmin.php");

// without options
file_put_contents("path/to/target.css", cssmin::minify(file_get_contents("path/to/source.css")));

// with the options remove-last-semicolon and preserve-urls
file_put_contents("path/to/target.css", cssmin::minify(file_get_contents("path/to/source.css"), "remove-last-semicolon,preserve-urls"));








Hosted by Google Code