1
0
mirror of https://github.com/mrclay/minify.git synced 2025-07-31 19:30:29 +02:00

Adds config option to concatenate files only

This commit is contained in:
Kaue Santoja
2015-09-02 17:08:33 -03:00
committed by Steve Clay
parent cabd595a5a
commit d233b65d3d
6 changed files with 41 additions and 10 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

@@ -52,6 +52,10 @@ if ($min_allowDebugFlag) {
$min_serveOptions['debug'] = Minify_DebugDetector::shouldDebugRequest($_COOKIE, $_GET, $_SERVER['REQUEST_URI']);
}
if (!empty($min_concatOnly)) {
$min_serveOptions['concatOnly'] = true;
}
if ($min_errorLogger) {
if (true === $min_errorLogger) {
$min_errorLogger = FirePHP::getInstance(true);
@@ -75,8 +79,10 @@ if (isset($_GET['f']) || isset($_GET['g'])) {
if (! isset($min_serveController)) {
$min_serveController = new Minify_Controller_MinApp();
}
Minify::serve($min_serveController, $min_serveOptions);
} elseif ($min_enableBuilder) {
header('Location: builder/');
exit;

View File

@@ -125,6 +125,9 @@ class Minify {
* 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
* content-type:
@@ -252,9 +255,19 @@ class Minify {
unset($cg);
}
if (self::$_options['contentType'] === self::TYPE_CSS
&& self::$_options['rewriteCssUris']) {
foreach($controller->sources as $key => $source) {
if (self::$_options['concatOnly']) {
foreach ($controller->sources as $key => $source) {
if (self::$_options['contentType'] === self::TYPE_JS) {
$source->minifier = "";
} elseif (self::$_options['contentType'] === self::TYPE_CSS) {
$source->minifier = array('Minify_CSS', 'minify');
$source->minifyOptions['compress'] = false;
}
}
}
if (self::$_options['contentType'] === self::TYPE_CSS && self::$_options['rewriteCssUris']) {
foreach ($controller->sources as $key => $source) {
if ($source->filepath
&& !isset($source->minifyOptions['currentDir'])
&& !isset($source->minifyOptions['prependRelativePath'])

View File

@@ -51,6 +51,7 @@ abstract class Minify_Controller_Base {
,'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.
@@ -145,9 +146,7 @@ abstract class Minify_Controller_Base {
/**
* instances of Minify_Source, which provide content and any individual minification needs.
*
* @var array
*
* @see Minify_Source
* @var Minify_Source[]
*/
public $sources = array();