Skip to content

Commit

Permalink
Merge pull request #125 from devongovett/master
Browse files Browse the repository at this point in the history
Allow inSourceMap option to be a generated JSON source map
  • Loading branch information
mishoo committed Mar 13, 2013
2 parents 9b1a40d + f276745 commit 24e58ee
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions tools/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,26 @@ exports.minify = function(files, options) {
}

// 4. output
var map = null;
var inMap = null;
if (options.inSourceMap) {
var inMap = options.inSourceMap;
var output = {};
if (typeof options.inSourceMap == "string") {
inMap = fs.readFileSync(options.inSourceMap, "utf8");
}
if (options.outSourceMap) map = UglifyJS.SourceMap({
file: options.outSourceMap,
orig: inMap,
root: options.sourceRoot
});
var output = { source_map: map };
if (options.outSourceMap) {
output.source_map = UglifyJS.SourceMap({
file: options.outSourceMap,
orig: inMap,
root: options.sourceRoot
});
}
if (options.output) {
UglifyJS.merge(output, options.output);
}
var stream = UglifyJS.OutputStream(output);
toplevel.print(stream);
return {
code : stream + "",
map : map + ""
map : output.source_map + ""
};
};

Expand Down

0 comments on commit 24e58ee

Please sign in to comment.