mirror of
https://github.com/mrclay/minify.git
synced 2025-01-29 11:18:30 +01:00
Adds config option to concatenate files only
This commit is contained in:
parent
cabd595a5a
commit
d233b65d3d
@ -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
|
||||||
|
5
MIN.txt
5
MIN.txt
@ -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
|
||||||
|
@ -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".
|
||||||
|
@ -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);
|
||||||
@ -74,8 +78,10 @@ if (isset($_GET['g'])) {
|
|||||||
if (isset($_GET['f']) || isset($_GET['g'])) {
|
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/');
|
||||||
|
@ -124,6 +124,9 @@ class Minify {
|
|||||||
* 'debug' : set to true to minify all sources with the 'Lines' controller, which
|
* 'debug' : set to true to minify all sources with the 'Lines' controller, which
|
||||||
* 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
|
||||||
@ -251,11 +254,21 @@ class Minify {
|
|||||||
$headers = $cg->getHeaders();
|
$headers = $cg->getHeaders();
|
||||||
unset($cg);
|
unset($cg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self::$_options['contentType'] === self::TYPE_CSS
|
if (self::$_options['concatOnly']) {
|
||||||
&& self::$_options['rewriteCssUris']) {
|
foreach ($controller->sources as $key => $source) {
|
||||||
foreach($controller->sources as $key => $source) {
|
if (self::$_options['contentType'] === self::TYPE_JS) {
|
||||||
if ($source->filepath
|
$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['currentDir'])
|
||||||
&& !isset($source->minifyOptions['prependRelativePath'])
|
&& !isset($source->minifyOptions['prependRelativePath'])
|
||||||
) {
|
) {
|
||||||
@ -493,7 +506,7 @@ class Minify {
|
|||||||
// get next source
|
// get next source
|
||||||
$source = null;
|
$source = null;
|
||||||
if ($i < $l) {
|
if ($i < $l) {
|
||||||
$source = self::$_controller->sources[$i];
|
$source = self::$_controller->sources[$i];
|
||||||
/* @var Minify_Source $source */
|
/* @var Minify_Source $source */
|
||||||
$sourceContent = $source->getContent();
|
$sourceContent = $source->getContent();
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user