mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 08:07:50 +00:00
build.js: Print compression status messages to the console.
Former-commit-id: 07524fbba01e45f0e51f24b61081527e59cb0006
This commit is contained in:
8
build.js
8
build.js
@@ -120,6 +120,8 @@
|
||||
throw exception;
|
||||
}
|
||||
|
||||
console.log("Compressing Lodash using the Closure Compiler...");
|
||||
|
||||
// post-process the compiled source
|
||||
compiledSource = postprocess(compiledSource);
|
||||
|
||||
@@ -138,6 +140,8 @@
|
||||
// explicit `binary` encoding is necessary to ensure that the stream is written correctly
|
||||
fs.writeFileSync(path.join(distPath, 'lodash.compiler.js.gz'), result, 'binary');
|
||||
|
||||
console.log("Done. Size: %d KB.", compiledSize);
|
||||
|
||||
// compress Lo-Dash using UglifyJS
|
||||
var ugly = uglifyJS.uglify,
|
||||
uglifiedSource = ugly.gen_code(
|
||||
@@ -153,6 +157,8 @@
|
||||
'ascii_only': true
|
||||
});
|
||||
|
||||
console.log("Compressing Lodash using UglifyJS...");
|
||||
|
||||
// post-process the uglified source and split lines at 500 characters for
|
||||
// consistency with Closure Compiler
|
||||
uglifiedSource = postprocess(ugly.split_lines(uglifiedSource, 500));
|
||||
@@ -168,6 +174,8 @@
|
||||
var uglifiedSize = result.length;
|
||||
fs.writeFileSync(path.join(distPath, 'lodash.uglify.js.gz'), result, 'binary');
|
||||
|
||||
console.log("Done. Size: %d KB.", uglifiedSize);
|
||||
|
||||
// select the smallest minified distribution and use it as the official
|
||||
// minified release
|
||||
fs.writeFileSync(path.join(__dirname, "lodash.min.js"), compiledSize < uglifiedSize ? compiledSource : uglifiedSource);
|
||||
|
||||
Reference in New Issue
Block a user