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

Unified Diff: tools/grit/grit/node/include.py

Issue 2179033002: Strip comments and whitespace from javascript resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert changes to screen.js (no longer needed for this CL) Created 4 years, 4 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/gather/chrome_html.py ('k') | tools/grit/grit/tool/build.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/grit/grit/node/include.py
diff --git a/tools/grit/grit/node/include.py b/tools/grit/grit/node/include.py
index 4bad78594727e45b7f25705336108cfec16866c2..c84fd54ccef2f2c129c7d5a162e3723cfb872093 100755
--- a/tools/grit/grit/node/include.py
+++ b/tools/grit/grit/node/include.py
@@ -15,6 +15,7 @@ import grit.format.gzip_string
import grit.format.html_inline
import grit.format.rc
import grit.format.rc_header
+from grit.format import minifier
from grit.node import base
class IncludeNode(base.Node):
@@ -89,13 +90,15 @@ class IncludeNode(base.Node):
from grit.format import rc_header
id_map = rc_header.GetIds(self.GetRoot())
id = id_map[self.GetTextualIds()[0]]
+ filename = self.ToRealPath(self.GetInputPath())
if self.attrs['flattenhtml'] == 'true':
allow_external_script = self.attrs['allowexternalscript'] == 'true'
data = self._GetFlattenedData(allow_external_script=allow_external_script)
else:
- filename = self.ToRealPath(self.GetInputPath())
data = util.ReadFile(filename, util.BINARY)
-
+ # Note that the minifier will only do anything if a minifier command
+ # has been set in the command line.
+ data = minifier.Minify(data, os.path.splitext(filename)[1])
if 'compress' in self.attrs and self.attrs['compress'] == 'gzip':
# We only use rsyncable compression on Linux.
# We exclude ChromeOS since ChromeOS bots are Linux based but do not have
« no previous file with comments | « tools/grit/grit/gather/chrome_html.py ('k') | tools/grit/grit/tool/build.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698