Horde_JavascriptMinify_Uglifyjs
extends Horde_JavascriptMinify_Null
in package
UglifyJS minification driver. Supports UglifyJS versions 1 (with limited features) and 2.
Tags
Table of Contents
- $_data : mixed
- Original javascript data.
- $_opts : array<string|int, mixed>
- Minification options.
- $_sourcemap : string
- Temporary file containing sourcemap data.
- __construct() : mixed
- Constructor.
- __toString() : mixed
- minify() : string
- Return the minified javascript.
- setOptions() : mixed
- sourcemap() : mixed
- Returns the sourcemap data.
- _sourceUrls() : string
- Creates a list of source comments linking to the original URLs of the source files.
Properties
$_data
Original javascript data.
protected
mixed
$_data
$_opts
Minification options.
protected
array<string|int, mixed>
$_opts
= array()
$_sourcemap
Temporary file containing sourcemap data.
protected
string
$_sourcemap
= \null
Methods
__construct()
Constructor.
public
__construct(mixed $js[, array<string|int, mixed> $opts = array() ]) : mixed
Parameters
- $js : mixed
-
Either a string (the JS text to compress) or an array of URLs (keys) to filenames (values) containing the JS data to compress.
- $opts : array<string|int, mixed> = array()
-
Additional options. See setOptions().
Return values
mixed —__toString()
public
__toString() : mixed
Tags
Return values
mixed —minify()
Return the minified javascript.
public
minify() : string
Return values
string —Minified javascript.
setOptions()
public
setOptions([array<string|int, mixed> $opts = array() ]) : mixed
Parameters
- $opts : array<string|int, mixed> = array()
-
Driver specific options:
- cmdline: (string) Command-line options to pass to binary. - sourcemap: (string) The URL to the web-accessible location the sourcemap file will be stored at. Only supported by UglifyJS2. - uglifyjs: (string) [REQUIRED] Path to the UglifyJS binary.
Return values
mixed —sourcemap()
Returns the sourcemap data.
public
sourcemap() : mixed
Only supported if javascript is data is provided via web-accessible static files. minify() must be called before this method will return any data.
Return values
mixed —The sourcemap data, or null if it doesn't exist.
_sourceUrls()
Creates a list of source comments linking to the original URLs of the source files.
protected
_sourceUrls() : string
Needed in minification files to ensure that all license terms of the minified code (which may have been removed during the minification process) are accessible.
Tags
Return values
string —Source URL data.