Documentation

Horde_JavascriptMinify_Uglifyjs extends Horde_JavascriptMinify_Null
in package

UglifyJS minification driver. Supports UglifyJS versions 1 (with limited features) and 2.

Tags
author

Michael Slusarz slusarz@horde.org

category

Horde

copyright

2014-2017 Horde LLC

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

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

$_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

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
since
1.1.0
Return values
string

Source URL data.

Search results