Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Unified Diff: tools/js2c.py

Issue 19012: Strip /* */ style comments in js2c. Saves ~17k of binary size. (Closed)
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/js2c.py
diff --git a/tools/js2c.py b/tools/js2c.py
index fb6d6c54a881e20cd60aad60673c9406c9e077e9..d568556ebfcd7df11df10051188cb8ff7635b770 100755
--- a/tools/js2c.py
+++ b/tools/js2c.py
@@ -50,6 +50,7 @@ def CompressScript(lines):
# Note that we could easily compress the scripts mode but don't
# since we want it to remain readable.
lines = re.sub('//.*\n', '\n', lines) # end-of-line comments
+ lines = re.sub(re.compile(r'/\*.*?\*/', re.DOTALL), '', lines) # comments.
lines = re.sub('\s+\n+', '\n', lines) # trailing whitespace
return lines
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698