jssource/jsmin.php

Show: inherited
Table of Contents

\SugarMin

Package:

Methods

methodprivate__construct(  $text,  $compression ) : void

jsParser will take javascript source code and minify it.

Note: There is a lot of redundant code since both passes operate similarly but with slight differences. It will probably be a good idea to refactor the code at a later point when it is stable.

JSParser will perform 3 passes on the code. Pass 1 takes care of single line and mult-line comments. Pass 2 performs some sanitation on each of the lines and pass 3 works on stripping out unnecessary spaces.

Parameters
Name Type Description
$text
$compression
methodprotectedjsParser( ) : void

methodpublicminify( string $js, string $compression = 'light' ) : string
static

Entry point function to minify javascript.

Parameters
Name Type Description
$js string

Javascript source code as a string.

$compression string

Compression option. {light, deep}.

Returns
Type Description
string $output Output javascript code as a string.
Documentation was generated by DocBlox 0.18.1.