1
0
mirror of https://github.com/mrclay/minify.git synced 2025-07-31 11:20:14 +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) (master)
* Builder styled with Bootstrap (thanks to help from acidvertigo) * Builder styled with Bootstrap (thanks to help from acidvertigo)
* Add config option for simply concatenating files
Version 2.2.0 Version 2.2.0
* Fix handling of RegEx in certain situations in JSMin * 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. 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? QUESTIONS?
http://groups.google.com/group/minify http://groups.google.com/group/minify

View File

@@ -12,6 +12,13 @@
*/ */
$min_enableBuilder = false; $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. * If non-empty, the Builder will be protected with HTTP Digest auth.
* The username is "admin". * The username is "admin".

View File

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

View File

@@ -125,6 +125,9 @@ class Minify {
* eases the debugging of combined files. This also prevents 304 responses. * eases the debugging of combined files. This also prevents 304 responses.
* @see Minify_Lines::minify() * @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 * 'minifiers' : to override Minify's default choice of minifier function for
* a particular content-type, specify your callback under the key of the * a particular content-type, specify your callback under the key of the
* content-type: * content-type:
@@ -252,8 +255,18 @@ class Minify {
unset($cg); unset($cg);
} }
if (self::$_options['contentType'] === self::TYPE_CSS if (self::$_options['concatOnly']) {
&& self::$_options['rewriteCssUris']) { 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) { foreach ($controller->sources as $key => $source) {
if ($source->filepath if ($source->filepath
&& !isset($source->minifyOptions['currentDir']) && !isset($source->minifyOptions['currentDir'])

View File

@@ -51,6 +51,7 @@ abstract class Minify_Controller_Base {
,'bubbleCssImports' => false ,'bubbleCssImports' => false
,'quiet' => false // serve() will send headers and output ,'quiet' => false // serve() will send headers and output
,'debug' => false ,'debug' => false
,'concatOnly' => false
// if you override these, the response codes MUST be directly after // if you override these, the response codes MUST be directly after
// the first space. // the first space.
@@ -145,9 +146,7 @@ abstract class Minify_Controller_Base {
/** /**
* instances of Minify_Source, which provide content and any individual minification needs. * instances of Minify_Source, which provide content and any individual minification needs.
* *
* @var array * @var Minify_Source[]
*
* @see Minify_Source
*/ */
public $sources = array(); public $sources = array();