Skip to content

A (simple) css minifier with benefits

Notifications You must be signed in to change notification settings

JoeScylla/cssmin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

What is CssMin?

WARNING: This repository is not maintained anymore because of time constraints. There were no updates for a long time. USE AT YOUR OWN RISK.

CssMin is a css parser and minfier. It minifies css by removing unneeded whitespace character, comments, empty blocks and empty declarations. In addition declaration values can get rewritten to shorter notation if available. The minification if configurable.

CssMin has some benefits. It supports the rewrite of CSS Level 3 properties to their browser specific counterparts and is able to simulate CSS Variables.

Requirements:

  • PHP 5.x

Syntax:

string CssMin::minify(string $source [, array $filters = array()][, array $plugins = array()]);

string $source

The source css as string.

array $filters

The filter configuration as array (optional).

array $plugins

The plugin configuration as array (optional).

Example

// Simple minification WITHOUT filter or plugin configuration
$result = CssMin::minify(file_get_contents("path/to/source.css"));

// Minification WITH filter or plugin configuration
$filters = array(/.../);
$plugins = array(/.../);
// Minify via CssMin adapter function
$result = CssMin::minify(file_get_contents("path/to/source.css"), $filters, $plugins);
// Minify via CssMinifier class
$minifier = new CssMinifier(file_get_contents("path/to/source.css"), $filters, $plugins);
$result = $minifier->getMinified();

About

A (simple) css minifier with benefits

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages