Skip to content
This repository was archived by the owner on Mar 18, 2022. It is now read-only.

Commit e9d6d9a

Browse files
authored
Merge branch 'master' into data-src
2 parents 295da5d + 4f713f7 commit e9d6d9a

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

lib/main.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ var pushFileToS3 = function(S3, text, fileName, headers, callback) {
185185
req.end();
186186
});
187187
});
188-
}
188+
};
189189

190190
var compile = function(fileName, assets, S3, options, method, type, timestamp, callback) {
191191
return function(err, results) {
@@ -207,19 +207,15 @@ var compile = function(fileName, assets, S3, options, method, type, timestamp, c
207207
case 'uglify':
208208
if (results instanceof Array)
209209
results = results.join("\n");
210-
try {
211-
var final_code = uglify.minify(results, {
212-
fromString: true,
213-
output: {
214-
comments: /license/
215-
}
216-
}).code;
217-
pushFileToS3(S3, final_code, fileName, headers, callback);
218-
} catch(err) {
210+
var uglifyResult = uglify.minify(results);
211+
212+
if (uglifyResult.error !== undefined) {
219213
logger({
220214
task: 'express-cdn',
221-
message: 'Failed to minify ' + fileName + ' due to uglify-js error.'})
222-
throw err
215+
message: 'Failed to minify ' + fileName + ' due to uglify-js error.'});
216+
throwError(uglifyResult.error);
217+
} else {
218+
pushFileToS3(S3, uglifyResult.code, fileName, headers, callback);
223219
}
224220
break;
225221
case 'minify':

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "express-cdn",
33
"description": "Node.js module for delivering optimized, minified, mangled, gzipped, and CDN-hosted assets in Express using S3 and CloudFront.",
4-
"version": "0.4.2",
4+
"version": "0.4.3",
55
"author": {
66
"name": "Nick Baugh",
77
"email": "[email protected]"

0 commit comments

Comments
 (0)