diff options
author | joassouza <joassouzasantos@gmail.com> | 2017-02-07 15:06:49 -0200 |
---|---|---|
committer | joassouza <joassouzasantos@gmail.com> | 2017-02-07 15:06:49 -0200 |
commit | 0025613ba6d954572b88f9797b60f3b2541b8b86 (patch) | |
tree | 88901e53ea6c1ec73de3a7896d7101afcf08fec0 /src | |
parent | d1e6c8492d3935552100dd9023d3b16fd180fa76 (diff) | |
download | etherpad-lite-0025613ba6d954572b88f9797b60f3b2541b8b86.zip |
Refactor code
Diffstat (limited to 'src')
-rw-r--r-- | src/node/utils/Minify.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/node/utils/Minify.js b/src/node/utils/Minify.js index 2be1fea4..a56e347d 100644 --- a/src/node/utils/Minify.js +++ b/src/node/utils/Minify.js @@ -375,9 +375,7 @@ function getFileCompressed(filename, contentType, callback) { callback(error, content); } else if (contentType == 'text/javascript') { try { - var decoder = new StringDecoder('utf8'); - var code = decoder.write(content); // convert from buffer to string - content = uglifyJS.minify(code, {fromString: true}).code; + content = compressJS(content); } catch (error) { // silence } @@ -400,6 +398,14 @@ 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; +} + function compressCSS(filename, content, callback) { try { |