1
0
mirror of https://github.com/mrclay/minify.git synced 2025-01-17 21:28:14 +01: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);
@ -74,8 +78,10 @@ if (isset($_GET['g'])) {
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/');

View File

@ -124,6 +124,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
@ -251,11 +254,21 @@ class Minify {
$headers = $cg->getHeaders();
unset($cg);
}
if (self::$_options['contentType'] === self::TYPE_CSS
&& self::$_options['rewriteCssUris']) {
foreach($controller->sources as $key => $source) {
if ($source->filepath
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'])
) {
@ -493,7 +506,7 @@ class Minify {
// get next source
$source = null;
if ($i < $l) {
$source = self::$_controller->sources[$i];
$source = self::$_controller->sources[$i];
/* @var Minify_Source $source */
$sourceContent = $source->getContent();

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();