1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-06 22:26:28 +02:00

Merge commit 'd233b65d3dc183933c5be8a16b5b7eaf313ef66c' into 3.0

This commit is contained in:
Steve Clay
2015-09-27 17:44:11 -04:00
5 changed files with 35 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ Minify Release History
(master)
* Builder styled with Bootstrap (thanks to help from acidvertigo)
* Add config option for simply concatenating files
Version 2.2.0
* Fix handling of RegEx in certain situations in JSMin

View File

@@ -176,6 +176,11 @@ file. To enable this, set $min_allowDebugFlag to true in config.php and append
Known issue: files with comment-like strings/regexps can cause problems in this mode.
BYPASSING MINIFICATION
See the $min_concatOnly option in config.php.
QUESTIONS?
http://groups.google.com/group/minify

View File

@@ -12,6 +12,13 @@
*/
$min_enableBuilder = false;
/**
* Concatenate but do not minify the files. This can be used for testing.
*/
$min_concatOnly = false;
/**
* If non-empty, the Builder will be protected with HTTP Digest auth.
* The username is "admin".

View File

@@ -64,6 +64,10 @@ if ($min_allowDebugFlag) {
$min_serveOptions['debug'] = Minify_DebugDetector::shouldDebugRequest($env);
}
if (!empty($min_concatOnly)) {
$min_serveOptions['concatOnly'] = true;
}
if ($min_errorLogger) {
if (true === $min_errorLogger) {
$min_errorLogger = FirePHP::getInstance(true);
@@ -86,7 +90,6 @@ if (null !== $env->get('g')) {
if ($env->get('f') || null !== $env->get('g')) {
// serving!
if (! isset($min_serveController)) {
$sourceFactoryOptions = array();
// translate legacy setting to option for source factory

View File

@@ -96,6 +96,7 @@ class Minify {
'bubbleCssImports' => false,
'quiet' => false, // serve() will send headers and output
'debug' => false,
'concatOnly' => false,
// if you override these, the response codes MUST be directly after
// the first space.
@@ -155,6 +156,9 @@ class Minify {
* 'debug' : set to true to minify all sources with the 'Lines' controller, which
* eases the debugging of combined files. This also prevents 304 responses.
* @see Minify_Lines::minify()
*
* 'concatOnly' : set to true to disable minification and simply concatenate the files.
* For JS, no minifier will be used. For CSS, only URI rewriting is still performed.
*
* 'minifiers' : to override Minify's default choice of minifier function for
* a particular content-type, specify your callback under the key of the
@@ -282,6 +286,20 @@ class Minify {
if ($this->options['contentType'] === self::TYPE_CSS && $this->options['rewriteCssUris']) {
$this->setupUriRewrites();
}
if ($this->options['concatOnly']) {
$this->options['minifiers'][self::TYPE_JS] = false;
foreach ($this->sources as $key => $source) {
if ($this->options['contentType'] === self::TYPE_JS) {
$source->setMinifier("");
} elseif ($this->options['contentType'] === self::TYPE_CSS) {
$source->setMinifier(array('Minify_CSS', 'minify'));
$sourceOpts = $source->getMinifierOptions();
$sourceOpts['compress'] = false;
$source->setMinifierOptions($sourceOpts);
}
}
}
// check server cache
if (! $this->options['debug']) {
@@ -503,7 +521,6 @@ class Minify {
$source = null;
if ($i < $l) {
$source = $this->sources[$i];
/* @var Minify_Source $source */
$sourceContent = $source->getContent();
// allow the source to override our minifier and options