allow ascii_only flag on compression

This commit is contained in:
Ben Toews 2015-09-10 14:11:15 -06:00
parent ba939ccd6c
commit 07081ff18c
3 changed files with 23 additions and 0 deletions

View File

@ -225,6 +225,9 @@ if (ARGS.keep_fnames) {
if (BEAUTIFY)
UglifyJS.merge(OUTPUT_OPTIONS, BEAUTIFY);
if (COMPRESS)
OUTPUT_OPTIONS.ascii_only = !!COMPRESS.ascii_only
if (ARGS.comments != null) {
if (/^\/.*\/[a-zA-Z]*$/.test(ARGS.comments)) {
try {

View File

@ -74,6 +74,7 @@ function Compressor(options, false_by_default) {
screw_ie8 : false,
drop_console : false,
angular : false,
ascii_only : false,
warnings : true,
global_defs : {}

View File

@ -0,0 +1,19 @@
prevents_unicode_escape_sequences_from_being_converted: {
options = {ascii_only: true};
input: {
var a = "\u2000";
}
expect: {
var a = "\u2000";
}
}
converts_unicode_characters_to_escape_sequences: {
options = {ascii_only: true};
input: {
var a = " ";
}
expect: {
var a = "\u2000";
}
}