From da1caf6bb7a1721f7201b16eaf07fc32eb868cc3 Mon Sep 17 00:00:00 2001 From: eleith Date: Thu, 24 Oct 2013 00:29:57 -0700 Subject: [PATCH] allow for multiple files to be associated with an array of strings --- tools/node.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/node.js b/tools/node.js index 5f9ae178..89f7f246 100644 --- a/tools/node.js +++ b/tools/node.js @@ -61,19 +61,24 @@ exports.minify = function(files, options) { output : null, compress : {} }); - if (typeof files == "string") + if (typeof files == "string") { files = [ files ]; + if (options.fromFile !== null) { + option.fromFile = [options.fromFile]; + } + } + UglifyJS.base54.reset(); // 1. parse var toplevel = null; - files.forEach(function(file){ + files.forEach(function(file, index){ var code = options.fromString ? file : fs.readFileSync(file, "utf8"); toplevel = UglifyJS.parse(code, { - filename: options.fromString ? options.fromFile || "?" : file, + filename: options.fromString ? options.fromFile[index] || "?" : file, toplevel: toplevel }); });