minifier: dont strip whitespace inside string literals

This commit is contained in:
bleck9999 2021-08-02 21:25:36 +01:00
parent 6ad5c7b5f6
commit b678673d95
No known key found for this signature in database
GPG Key ID: D0CA0C41DB616843
1 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,6 @@
# Copyright (c) 2021 bleck9999
# https://github.com/bleck9999/ts-minifier
# Version: 700ce8d
# Copyright (c) 2021 bleck9999
# https://github.com/bleck9999/ts-minifier
# Version: a1e97807
import argparse
import itertools
@ -322,13 +322,13 @@ def whitespacent(script: str):
if part % 2 == 0:
if not line[part]:
break
mcode += line[part].replace('\t', '') + ' '
# turn lots of whitespace into one whitespace with one easy trick!
mcode += ' '.join(line[part].split()) + ' '
else:
mcode += f'"{line[part]}"'
part += 1
mcode = " ".join(mcode.split()) # turn lots of whitespace into one whitespace with one easy trick!
# tsv3 is still an absolute nightmare
# so spaces have a couple edge cases
# 1. the - operator which requires space between the right operand