loleaflet-draw: Return early if no changes

Compression is most expensive in terms of time; if we detect
early that there are no changes between oldSrc and newSrc, lets
return early and skip the compression.

Change-Id: Id3d7c1d4bf89a33819907ff735e01629581627a3
This commit is contained in:
Pranav Kant 2016-12-09 18:02:53 +05:30
parent 076e779649
commit b940b34ab1

View file

@ -99,11 +99,13 @@ exports.build = function (callback, compsBase32, buildName) {
console.log('\tUncompressed: ' + bytesToKB(newSrc.length) + srcDelta);
if (newSrc !== oldSrc) {
fs.writeFileSync(srcPath, newSrc);
console.log('\tSaved to ' + srcPath);
if (srcDelta === ' (unchanged)') {
return;
}
fs.writeFileSync(srcPath, newSrc);
console.log('\tSaved to ' + srcPath);
var path = pathPart + '.js',
oldCompressed = loadSilently(path),
newCompressed = copy + UglifyJS.minify(newSrc, {