mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Add Java options for faster Closure Compiler minification to minify.js.
Former-commit-id: b493d461e78d0df80c80805a570220fdff93d487
This commit is contained in:
@@ -3,8 +3,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/** Load Node.js modules */
|
/** Load Node.js modules */
|
||||||
var https = require('https'),
|
var cp = require('child_process'),
|
||||||
spawn = require('child_process').spawn,
|
https = require('https'),
|
||||||
zlib = require('zlib');
|
zlib = require('zlib');
|
||||||
|
|
||||||
/** Load other modules */
|
/** Load other modules */
|
||||||
@@ -59,6 +59,17 @@
|
|||||||
};
|
};
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Java command-line options used for faster minification.
|
||||||
|
* See https://code.google.com/p/closure-compiler/wiki/FAQ#What_are_the_recommended_Java_VM_command-line_options?.
|
||||||
|
*/
|
||||||
|
var javaOptions = [];
|
||||||
|
cp.exec('java -version -client -d32', function(error) {
|
||||||
|
if (!error && process.platform != 'win32') {
|
||||||
|
javaOptions.push('-client', '-d32');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/** The Closure Compiler optimization modes */
|
/** The Closure Compiler optimization modes */
|
||||||
var optimizationModes = {
|
var optimizationModes = {
|
||||||
'simple': 'SIMPLE_OPTIMIZATIONS',
|
'simple': 'SIMPLE_OPTIMIZATIONS',
|
||||||
@@ -375,8 +386,7 @@
|
|||||||
if (isMapped) {
|
if (isMapped) {
|
||||||
options.push('--create_source_map=' + mapPath, '--source_map_format=V3');
|
options.push('--create_source_map=' + mapPath, '--source_map_format=V3');
|
||||||
}
|
}
|
||||||
|
var compiler = cp.spawn('java', javaOptions.concat('-jar', closurePath, options));
|
||||||
var compiler = spawn('java', ['-jar', closurePath].concat(options));
|
|
||||||
if (!this.isSilent) {
|
if (!this.isSilent) {
|
||||||
console.log('Compressing ' + path.basename(outputPath, '.js') + ' using the Closure Compiler (' + mode + ')...');
|
console.log('Compressing ' + path.basename(outputPath, '.js') + ' using the Closure Compiler (' + mode + ')...');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user