From b678673d952140032d10ac6cdabe559cf1978895 Mon Sep 17 00:00:00 2001 From: bleck9999 <55853712+bleck9999@users.noreply.github.com> Date: Mon, 2 Aug 2021 21:25:36 +0100 Subject: [PATCH] minifier: dont strip whitespace inside string literals --- ts-minifier.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ts-minifier.py b/ts-minifier.py index afa05cc..8e1384d 100644 --- a/ts-minifier.py +++ b/ts-minifier.py @@ -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