PHP Class Minify_Lines, minify

Author: Stephen Clay ([email protected])
Author: Adam Pedersen (Issue 55 fix)
Afficher le fichier Open project: mrclay/minify

Méthodes publiques

Méthode Description
minify ( string $content, array $options = [] ) : string Add line numbers in C-style comments

Private Methods

Méthode Description
_addNote ( string $line, string $note, boolean $inComment, integer $padTo ) : string Prepend a comment (or note) to the given line
_eolInComment ( string $line, boolean $inComment ) : boolean Is the parser within a C-style comment at the end of this line?
_find ( string $str, string $token ) : boolean Find a token trying to avoid false positives

Method Details

minify() public static méthode

This uses a very basic parser easily fooled by comment tokens inside strings or regexes, but, otherwise, generally clean code will not be mangled. URI rewriting can also be performed.
public static minify ( string $content, array $options = [] ) : string
$content string
$options array available options: 'id': (optional) string to identify file. E.g. file name/path 'currentDir': (default null) if given, this is assumed to be the directory of the current CSS file. Using this, minify will rewrite all relative URIs in import/url declarations to correctly point to the desired files, and prepend a comment with debugging information about this process.
Résultat string