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

Unified Diff: tools/grit/grit/format/minifier.py

Issue 2337253002: Remove minification spam (Closed)
Patch Set: Respond to comments Created 4 years, 3 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 | « tools/grit/grit/format/html_inline.py ('k') | tools/grit/grit/node/include.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/grit/grit/format/minifier.py
diff --git a/tools/grit/grit/format/minifier.py b/tools/grit/grit/format/minifier.py
index 93d0df72f241cdba0c5aed4e446f3c1ec3288a67..84028f9a438014e7739b3378d40b6f176d878d49 100644
--- a/tools/grit/grit/format/minifier.py
+++ b/tools/grit/grit/format/minifier.py
@@ -3,7 +3,9 @@
# found in the LICENSE file.
"""Framework for stripping whitespace and comments from resource files"""
+from os import path
import subprocess
+import sys
__js_minifier = None
@@ -13,18 +15,23 @@ def SetJsMinifier(minifier):
__js_minifier = minifier.split()
-def Minify(source, file_type):
+def Minify(source, filename):
+ file_type = path.splitext(filename)[1]
if not file_type == '.js' or not __js_minifier:
return source
+ # TODO (BUG http://crbug/644392) searchbox_api.js uses Chrome extensions so
+ # can't be minified. Remove this when that is fixed.
+ if path.abspath(filename).endswith(
+ '/chrome/renderer/resources/extensions/searchbox_api.js'):
+ return source
p = subprocess.Popen(
__js_minifier,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
(stdout, stderr) = p.communicate(source)
- if stderr:
- print stderr
if p.returncode != 0:
- print 'Minification failed, using original source'
- return source
+ print 'Minification failed for %s' % filename
+ print stderr
+ sys.exit(p.returncode)
return stdout
« no previous file with comments | « tools/grit/grit/format/html_inline.py ('k') | tools/grit/grit/node/include.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698