diff options
author | Anthony Van de Gejuchte <anthonyvdgent@gmail.com> | 2016-09-03 23:26:31 +0200 |
---|---|---|
committer | Anthony Van de Gejuchte <anthonyvdgent@gmail.com> | 2016-09-06 17:54:45 +0200 |
commit | 0111497fc98d5098f81bc749f77da5734add37bb (patch) | |
tree | c0d7e4da363639a4c68457d2f90e2eebc61796e8 /bin | |
parent | 7d8dea3b2675f9d86ea15bb031b7fe166858d67e (diff) | |
download | tracifyjs-0111497fc98d5098f81bc749f77da5734add37bb.tar.gz tracifyjs-0111497fc98d5098f81bc749f77da5734add37bb.zip |
Make all comment options in cli available in js api
Also removing more code within "loop" while at it.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/uglifyjs | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs index 3f0c8254..8d7bd759 100755 --- a/bin/uglifyjs +++ b/bin/uglifyjs @@ -250,25 +250,10 @@ if (ARGS.keep_fnames) { if (BEAUTIFY) UglifyJS.merge(OUTPUT_OPTIONS, BEAUTIFY); -if (ARGS.comments != null) { - if (/^\/.*\/[a-zA-Z]*$/.test(ARGS.comments)) { - try { - OUTPUT_OPTIONS.comments = extractRegex(ARGS.comments); - } catch (e) { - print_error("ERROR: Invalid --comments: " + e.message); - } - } else if (ARGS.comments == "all") { - OUTPUT_OPTIONS.comments = true; - } else { - OUTPUT_OPTIONS.comments = function(node, comment) { - var text = comment.value; - var type = comment.type; - if (type == "comment2") { - // multiline comment - return /@preserve|@license|@cc_on/i.test(text); - } - } - } +if (ARGS.comments === "") { + OUTPUT_OPTIONS.comments = "some"; +} else { + OUTPUT_OPTIONS.comments = ARGS.comments; } var files = ARGS._.slice(); |