aboutsummaryrefslogtreecommitdiffstats
path: root/maintenance/minify.php
diff options
context:
space:
mode:
authorRoan Kattouw <catrope@users.mediawiki.org>2011-03-14 13:24:30 +0000
committerRoan Kattouw <catrope@users.mediawiki.org>2011-03-14 13:24:30 +0000
commit47d5ad564bb7e06539981068ccf3432e2e30d91e (patch)
treef513223e48bc318551b717fc9dd2df9b3d35afe7 /maintenance/minify.php
parent9f7c81c394578a97f34449a5912c186213eeda0a (diff)
downloadmediawikicore-47d5ad564bb7e06539981068ccf3432e2e30d91e.tar.gz
mediawikicore-47d5ad564bb7e06539981068ccf3432e2e30d91e.zip
Followup r83885: implement maximum line length and statement termination (each statement on its own line) in JavaScriptMinifier. Also add globals for these things and update minify.php for these new config vars.
Notes
Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/83891
Diffstat (limited to 'maintenance/minify.php')
-rw-r--r--maintenance/minify.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/maintenance/minify.php b/maintenance/minify.php
index de9c53a960a2..c50f941b48c7 100644
--- a/maintenance/minify.php
+++ b/maintenance/minify.php
@@ -35,8 +35,11 @@ class MinifyScript extends Maintenance {
"Directory for output. If this is not specified, and neither is --outfile, then the\n" .
"output files will be sent to the same directories as the input files.",
false, true );
- $this->addOption( 'minify-vertical-space',
- "Boolean value for minifying the vertical space for javascript.",
+ $this->addOption( 'js-statements-on-own-line',
+ "Boolean value for putting statements on their own line when minifying JavaScript.",
+ false, true );
+ $this->addOption( 'js-max-line-length',
+ "Maximum line length for JavaScript minification.",
false, true );
$this->mDescription = "Minify a file or set of files.\n\n" .
"If --outfile is not specified, then the output file names will have a .min extension\n" .
@@ -99,7 +102,7 @@ class MinifyScript extends Maintenance {
}
public function minify( $inPath, $outPath ) {
- global $wgResourceLoaderMinifyJSVerticalSpace;
+ global $wgResourceLoaderMinifierStatementsOnOwnLine, $wgResourceLoaderMinifierMaxLineLength;
$extension = $this->getExtension( $inPath );
$this->output( basename( $inPath ) . ' -> ' . basename( $outPath ) . '...' );
@@ -117,7 +120,10 @@ class MinifyScript extends Maintenance {
switch ( $extension ) {
case 'js':
- $outText = JavaScriptDistiller::stripWhiteSpace( $inText, $this->getOption( 'minify-vertical-space', $wgResourceLoaderMinifyJSVerticalSpace ) );
+ $outText = JavaScriptMinifier::minify( $inText,
+ $this->getOption( 'js-statements-on-own-line', $wgResourceLoaderMinifierStatementsOnOwnLine ),
+ $this->getOption( 'js-max-line-length', $wgResourceLoaderMinifierMaxLineLength )
+ );
break;
case 'css':
$outText = CSSMin::minify( $inText );