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:
parent
076e779649
commit
b940b34ab1
1 changed files with 5 additions and 3 deletions
|
@ -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, {
|
||||
|
|
Loading…
Reference in a new issue