wikimedia/minify
Minification of JavaScript code and CSS stylesheets
|
The base class for stateful minifying with source map fetching. More...
Public Member Functions | |
addSourceFile (string $url, string $source, bool $bundle=false) | |
Minify a source file and collect the output and mappings data. | |
addOutput (string $output) | |
Add a string to the output without any minification or source mapping. | |
getSourceMapData () | |
Get the source map data to be JSON encoded. | |
getRawSourceMap () | |
Get the JSON-encoded source map. | |
getSourceMap () | |
Get the JSON-encoded source map including XSSI protection prefix. | |
Public Member Functions inherited from Wikimedia\Minify\MinifierState | |
outputFile (string $file) | |
Set the name of the output file, to be given as the "file" key. | |
sourceRoot (string $url) | |
Set the source root. | |
setErrorHandler ( $onError) | |
Register an error callback. | |
ensureNewline () | |
Add a line break to the output if the output is non-empty and does not end in a line break. | |
getMinifiedOutput () | |
Get the minified output. | |
Protected Attributes | |
$mappingsGenerator | |
Protected Attributes inherited from Wikimedia\Minify\MinifierState | |
$sources = [] | |
$sourcesContent = [] | |
$minifiedOutput = '' | |
$outputFile | |
$sourceRoot | |
$onError | |
Additional Inherited Members | |
Protected Member Functions inherited from Wikimedia\Minify\MinifierState | |
minify (string $source) | |
Minify a string. | |
The base class for stateful minifying with source map fetching.
Wikimedia\Minify\MapperState::addOutput | ( | string | $output | ) |
Add a string to the output without any minification or source mapping.
string | $output |
Reimplemented from Wikimedia\Minify\MinifierState.
Wikimedia\Minify\MapperState::addSourceFile | ( | string | $url, |
string | $source, | ||
bool | $bundle = false ) |
Minify a source file and collect the output and mappings data.
string | $url | The name of the input file. Possibly a URL relative to the source root. |
string | $source | The input source text. |
bool | $bundle | Whether to add the source text to sourcesContent |
Reimplemented from Wikimedia\Minify\MinifierState.
Wikimedia\Minify\MapperState::getRawSourceMap | ( | ) |
Get the JSON-encoded source map.
Take care to avoid leaking private data due to an XSSI attack.
Wikimedia\Minify\MapperState::getSourceMap | ( | ) |
Get the JSON-encoded source map including XSSI protection prefix.
Wikimedia\Minify\MapperState::getSourceMapData | ( | ) |
Get the source map data to be JSON encoded.