aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergej Tatarincev <st@bekitzur.com>2012-10-09 12:52:28 +0300
committerSergej Tatarincev <st@bekitzur.com>2012-10-09 12:52:28 +0300
commit203ecaf85ba7ad714e77c78b2102309d5581948c (patch)
tree20d556a14c8e2fa28ef5564162324478a17cf96b
parentc967f0b0fefd7db03922769f1d2aaf2ae1394ddc (diff)
downloadtracifyjs-203ecaf85ba7ad714e77c78b2102309d5581948c.tar.gz
tracifyjs-203ecaf85ba7ad714e77c78b2102309d5581948c.zip
Fix nodejs minify without inSourceMap exception
When inSourceMap is omitted fs.readFile throws exception. Fixed version calls fs.readFile only when inSourceMap argument is present
-rw-r--r--tools/node.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/node.js b/tools/node.js
index bf47abad..fccdd83f 100644
--- a/tools/node.js
+++ b/tools/node.js
@@ -92,9 +92,13 @@ exports.minify = function(files, options) {
// 4. output
var map = null;
+ var inMap = null;
+ if (options.inSourceMap) {
+ inMap = fs.readFileSync(options.inSourceMap, "utf8");
+ }
if (options.outSourceMap) map = UglifyJS.SourceMap({
file: options.outSourceMap,
- orig: fs.readFileSync(options.inSourceMap, "utf8")
+ orig: inMap
});
var stream = UglifyJS.OutputStream({ source_map: map });
toplevel.print(stream);