Property | Type | Description | |
---|---|---|---|
$additionalOptions | string[] | Additional options to pass to the compiler service | |
$fallbackMinifier | Function to minify JS if service fails. Default is JSMin | ||
$maxBytes | integer | The maximum JS size that can be sent to the compiler server in bytes | |
$serviceUrl | string |
Method | Description | |
---|---|---|
__construct ( array $options = [] ) | ||
min ( string $js ) : string | Call the service to perform the minification | |
minify ( string $js, array $options = [] ) : string | Minify JavaScript code via HTTP request to a Closure Compiler API |
Method | Description | |
---|---|---|
buildPostBody ( string $js, boolean $returnErrors = false ) : string | Build a POST request body | |
getResponse ( string $postBody ) : string | Get the response for a given POST body |
public __construct ( array $options = [] ) | ||
$options | array | Options with keys available below: fallbackFunc : (callable) function to minify if service unavailable. Default is JSMin. compilerUrl : (string) URL to closure compiler server maxBytes : (int) The maximum amount of bytes to be sent as js_code in the POST request. Defaults to 200000. additionalParams : (string[]) Additional parameters to pass to the compiler server. Can be anything named in https://developers.google.com/closure/compiler/docs/api-ref except for js_code and output_info |
protected getResponse ( string $postBody ) : string | ||
$postBody | string | |
return | string |
protected string[] $additionalOptions | ||
return | string[] |
protected $fallbackMinifier |
protected int $maxBytes | ||
return | integer |