[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/libs/ -> JavaScriptMinifier.php (summary)

JavaScript Minifier

Author: Paul Copperman <[email protected]>
License: Choose any of Apache, MIT, GPL, LGPL
File Size: 607 lines (23 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

JavaScriptMinifier:: (2 methods):
  minify()
  parseError()


Class: JavaScriptMinifier  - X-Ref

This class is meant to safely minify javascript code, while leaving syntactically correct
programs intact. Other libraries, such as JSMin require a certain coding style to work
correctly. OTOH, libraries like jsminplus, that do parse the code correctly are rather
slow, because they construct a complete parse tree before outputting the code minified.
So this class is meant to allow arbitrary (but syntactically correct) input, while being
fast enough to be used for on-the-fly minifying.

minify( $s, $statementsOnOwnLine = false, $maxLineLength = 1000 )   X-Ref
Returns minified JavaScript code.

NOTE: $maxLineLength isn't a strict maximum. Longer lines will be produced when
literals (e.g. quoted strings) longer than $maxLineLength are encountered
or when required to guard against semicolon insertion.

param: string $s JavaScript code to minify
param: bool $statementsOnOwnLine Whether to put each statement on its own line
param: int $maxLineLength Maximum length of a single line, or -1 for no maximum.
return: String Minified code

parseError($fullJavascript, $position, $errorMsg)   X-Ref
No description



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1