Horde_JavascriptMinify
in package
Abstract base class for implementing a javascript minification driver.
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
- Set minification options.
- 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
abstract minify() : string
Tags
Return values
string —Minified javascript.
setOptions()
Set minification options.
public
setOptions([array<string|int, mixed> $opts = array() ]) : mixed
Parameters
- $opts : array<string|int, mixed> = array()
-
Options:
- logger: (Horde_Log_Logger) Log object to use for log messages.
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.