mirror of
https://github.com/mrclay/minify.git
synced 2025-08-27 15:50:15 +02:00
Minify no longer tries to minify -min.js/.min.js files
2.2 used empty string as a magical value meaning do not minify, but in the refactoring `Minify::combineMinify` forgot to interpret this value that way and instead inherited the default compressor for the type. This eliminates `""` as a magical value, but for BC rewrites it to `Minify::nullMinifier` in the sources. Fixes #499
This commit is contained in:
@@ -190,7 +190,7 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
|
||||
,'lastModified' => 0
|
||||
// due to caching, filename is unreliable.
|
||||
,'content' => "/* Minify: at least one missing file. See " . Minify::URL_DEBUG . " */\n"
|
||||
,'minifier' => ''
|
||||
,'minifier' => 'Minify::nullMinifier'
|
||||
)));
|
||||
}
|
||||
|
||||
|
@@ -104,7 +104,7 @@ class Minify_Source implements Minify_SourceInterface {
|
||||
$this->contentType = $spec['contentType'];
|
||||
}
|
||||
if (isset($spec['minifier'])) {
|
||||
$this->minifier = $spec['minifier'];
|
||||
$this->setMinifier($spec['minifier']);
|
||||
}
|
||||
if (isset($spec['minifyOptions'])) {
|
||||
$this->minifyOptions = $spec['minifyOptions'];
|
||||
@@ -130,8 +130,15 @@ class Minify_Source implements Minify_SourceInterface {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setMinifier($minifier)
|
||||
public function setMinifier($minifier = null)
|
||||
{
|
||||
if ($minifier === '') {
|
||||
error_log(__METHOD__ . " cannot accept empty string. Use 'Minify::nullMinifier' or 'trim'.");
|
||||
$minifier = 'Minify::nullMinifier';
|
||||
}
|
||||
if ($minifier !== null && !is_callable($minifier, true)) {
|
||||
throw new \InvalidArgumentException('minifier must be null or a valid callable');
|
||||
}
|
||||
$this->minifier = $minifier;
|
||||
}
|
||||
|
||||
|
@@ -173,7 +173,7 @@ class Minify_Source_Factory {
|
||||
$spec['minifyOptions']['compress'] = false;
|
||||
// we still want URI rewriting to work for CSS
|
||||
} else {
|
||||
$spec['minifier'] = '';
|
||||
$spec['minifier'] = 'Minify::nullMinifier';
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@ interface Minify_SourceInterface {
|
||||
* @param callable $minifier
|
||||
* @return void
|
||||
*/
|
||||
public function setMinifier($minifier);
|
||||
public function setMinifier($minifier = null);
|
||||
|
||||
/**
|
||||
* Get options for the minifier
|
||||
|
Reference in New Issue
Block a user