|
@@ -146,7 +146,16 @@ var FileMinifier = function() {
|
|
|
.delay(1)
|
|
|
.then(splittedUglifyStep2)
|
|
|
.delay(1)
|
|
|
- .then(splittedUglifyStep3)
|
|
|
+ .then(function(ast) {
|
|
|
+ // Only do the compression step for smaller files
|
|
|
+ // otherwise it can take a very long time compared to the gain
|
|
|
+ if (body.length < 200*1024) {
|
|
|
+ return splittedUglifyStep3(ast);
|
|
|
+ } else {
|
|
|
+ debug('Skipping step 3 because the file is too big (%d bytes)!', body.length);
|
|
|
+ return ast;
|
|
|
+ }
|
|
|
+ })
|
|
|
.delay(1)
|
|
|
.then(splittedUglifyStep4)
|
|
|
.delay(1)
|
|
@@ -311,9 +320,9 @@ var FileMinifier = function() {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- // Avoid loosing tome trying to compress JS files if they alreay look minified
|
|
|
+ // Avoid loosing some trying to compress JS files if they alreay look minified
|
|
|
// by counting the number of lines compared to the total size.
|
|
|
- // Less than 1000kb per line is suspicious
|
|
|
+ // Less than 1KB per line is suspicious
|
|
|
function looksAlreadyMinified(code) {
|
|
|
var linesCount = code.split(/\r\n|\r|\n/).length;
|
|
|
var linesRatio = code.length / linesCount;
|