mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-24 01:16:15 -04:00
dependencies: upgrade uglify-js 2.6.2 -> 3.8.1 and adapt Minify
This was a major update that required code changes.
This commit is contained in:
parent
a286f32c2a
commit
8987c5d813
3 changed files with 96 additions and 243 deletions
|
@ -382,6 +382,12 @@ function getFileCompressed(filename, contentType, callback) {
|
|||
} else if (contentType == 'text/javascript') {
|
||||
try {
|
||||
content = compressJS(content);
|
||||
if (content.error) {
|
||||
console.error(`Error compressing JS (${filename}) using UglifyJS`, content.error);
|
||||
callback('compressionError', content.error);
|
||||
} else {
|
||||
content = content.code.toString(); // Convert content obj code to string
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`getFile() returned an error in getFileCompressed(${filename}, ${contentType}): ${error}`);
|
||||
}
|
||||
|
@ -406,10 +412,10 @@ function getFile(filename, callback) {
|
|||
|
||||
function compressJS(content)
|
||||
{
|
||||
var decoder = new StringDecoder('utf8');
|
||||
var code = decoder.write(content); // convert from buffer to string
|
||||
var codeMinified = uglifyJS.minify(code, {fromString: true}).code;
|
||||
return codeMinified;
|
||||
const contentAsString = content.toString();
|
||||
const codeObj = uglifyJS.minify(contentAsString);
|
||||
|
||||
return codeObj;
|
||||
}
|
||||
|
||||
function compressCSS(filename, content, callback)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue