aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-03-06 18:01:23 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-03-06 18:01:23 -0800
commitf5d7160fb4672884717be1d3c4c5c5b070d5003e (patch)
tree4df7955f695a5f4ab66a9d80a4e89eb07e9dc5ea
parentb2adfb09ae28da6f48fe117e518e3138dec6e983 (diff)
remove trivial whitespace
-rwxr-xr-xemcc8
1 files changed, 7 insertions, 1 deletions
diff --git a/emcc b/emcc
index d5812ad0..d54b30f7 100755
--- a/emcc
+++ b/emcc
@@ -75,7 +75,7 @@ emcc can be influenced by a few environment variables:
EMMAKEN_COMPILER - The compiler to be used, if you don't want the default clang.
'''
-import os, sys, shutil, tempfile, subprocess, shlex, time
+import os, sys, shutil, tempfile, subprocess, shlex, time, re
from subprocess import PIPE, STDOUT
from tools import shared
from tools.shared import Compression, execute, suffix, unsuffixed, unsuffixed_basename
@@ -1361,6 +1361,12 @@ try:
flush_js_optimizer_queue()
+ if not minify_whitespace:
+ # Remove some trivial whitespace
+ src = open(final).read()
+ src = re.sub(r'\n+[ \n]*\n+', '\n', src)
+ open(final, 'w').write(src)
+
# If we were asked to also generate HTML, do that
if final_suffix == 'html':
if DEBUG: print >> sys.stderr, 'emcc: generating HTML'