mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36:16 -04:00
Minify: on errors, generate logs instead of simply silencing them
This will help when we'll have to update clean-css.
This commit is contained in:
parent
c316402d86
commit
a1978d2245
1 changed files with 6 additions and 4 deletions
|
@ -275,7 +275,7 @@ function getAceFile(callback) {
|
||||||
data += 'Ace2Editor.EMBEDED[' + JSON.stringify(filename) + '] = '
|
data += 'Ace2Editor.EMBEDED[' + JSON.stringify(filename) + '] = '
|
||||||
+ JSON.stringify(status == 200 ? body || '' : null) + ';\n';
|
+ JSON.stringify(status == 200 ? body || '' : null) + ';\n';
|
||||||
} else {
|
} else {
|
||||||
// Silence?
|
console.error(`getAceFile(): error getting ${resourceURI}. Status code: ${status}`);
|
||||||
}
|
}
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
|
@ -382,7 +382,7 @@ function getFileCompressed(filename, contentType, callback) {
|
||||||
try {
|
try {
|
||||||
content = compressJS(content);
|
content = compressJS(content);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// silence
|
console.error(`getFile() returned an error in getFileCompressed(${filename}, ${contentType}): ${error}`);
|
||||||
}
|
}
|
||||||
callback(null, content);
|
callback(null, content);
|
||||||
} else if (contentType == 'text/css') {
|
} else if (contentType == 'text/css') {
|
||||||
|
@ -417,14 +417,16 @@ function compressCSS(filename, content, callback)
|
||||||
var base = path.join(ROOT_DIR, path.dirname(filename));
|
var base = path.join(ROOT_DIR, path.dirname(filename));
|
||||||
new CleanCSS({relativeTo: base}).minify(content, function (errors, minified) {
|
new CleanCSS({relativeTo: base}).minify(content, function (errors, minified) {
|
||||||
if (errors) {
|
if (errors) {
|
||||||
// On error, just yield the un-minified original.
|
// on error, just yield the un-minified original, but write a log message
|
||||||
|
console.error(`CleanCSS.minify() returned an error on ${filename} (base CSS path: ${base}): ${errors}`);
|
||||||
callback(null, content);
|
callback(null, content);
|
||||||
} else {
|
} else {
|
||||||
callback(null, minified.styles);
|
callback(null, minified.styles);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// On error, just yield the un-minified original.
|
// on error, just yield the un-minified original, but write a log message
|
||||||
|
console.error(`Unexpected error minifying ${filename} (base CSS path: ${base}): ${error}`);
|
||||||
callback(null, content);
|
callback(null, content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue