PHP Class Minify_CSS_Compressor, minify

This is a heavy regex-based removal of whitespace, unnecessary comments and tokens, and some CSS value minimization, where practical. Many steps have been taken to avoid breaking comment-based hacks, including the ie5/mac filter (and its inversion), but expect tricky hacks involving comment tokens in 'content' value strings to break minimization badly. A test suite is available. Note: This replaces a lot of spaces with line breaks. It's rumored (https://github.com/yui/yuicompressor/blob/master/README.md#global-options) that some source control tools and old browsers don't like very long lines. Compressed files with shorter lines are also easier to diff. If this is unacceptable please use CSSmin instead.
Deprecation: Use CSSmin (tubalmartin/cssmin)
Author: Stephen Clay ([email protected])
Author: http://code.google.com/u/1stvamp/ (Issue 64 patch)
Afficher le fichier Open project: mrclay/minify Class Usage Examples

Protected Properties

Свойство Type Description
$_inHack boolean Are we "in" a hack? I.e. are some browsers targetted until the next comment?
$_options array

Méthodes publiques

Méthode Description
process ( string $css, array $options = [] ) : string Minify a CSS string

Méthodes protégées

Méthode Description
_commentCB ( array $m ) : string Process a comment and return a replacement
_fontFamilyCB ( array $m ) : string Process a font-family listing and return a replacement
_process ( string $css ) : string Minify a CSS string
_selectorsCB ( array $m ) : string Replace what looks like a set of selectors

Private Methods

Méthode Description
__construct ( array $options ) Constructor

Method Details

_commentCB() protected méthode

Process a comment and return a replacement
protected _commentCB ( array $m ) : string
$m array regex matches
Résultat string

_fontFamilyCB() protected méthode

Process a font-family listing and return a replacement
protected _fontFamilyCB ( array $m ) : string
$m array regex matches
Résultat string

_process() protected méthode

Minify a CSS string
protected _process ( string $css ) : string
$css string
Résultat string

_selectorsCB() protected méthode

Replace what looks like a set of selectors
protected _selectorsCB ( array $m ) : string
$m array regex matches
Résultat string

process() public static méthode

Minify a CSS string
public static process ( string $css, array $options = [] ) : string
$css string
$options array (currently ignored)
Résultat string

Property Details

$_inHack protected_oe property

Are we "in" a hack? I.e. are some browsers targetted until the next comment?
protected bool $_inHack
Résultat boolean

$_options protected_oe property

protected array $_options
Résultat array