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

Side by Side Diff: tools/grit/grit/node/include.py

Issue 2094193004: Strip comments and whitespace from Javascript resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to comments, plus rebases. Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Handling of the <include> element. 6 """Handling of the <include> element.
7 """ 7 """
8 8
9 import os 9 import os
10 import sys 10 import sys
(...skipping 21 matching lines...) Expand all
32 # avoid doing it more than once. 32 # avoid doing it more than once.
33 self._last_flat_filename = None 33 self._last_flat_filename = None
34 34
35 def _IsValidChild(self, child): 35 def _IsValidChild(self, child):
36 return False 36 return False
37 37
38 def _GetFlattenedData(self, allow_external_script=False): 38 def _GetFlattenedData(self, allow_external_script=False):
39 if not self._flattened_data: 39 if not self._flattened_data:
40 filename = self.ToRealPath(self.GetInputPath()) 40 filename = self.ToRealPath(self.GetInputPath())
41 self._flattened_data = ( 41 self._flattened_data = (
42 grit.format.html_inline.InlineToString(filename, self, 42 grit.format.html_inline.InlineToString(filename,
43 self.EvaluateCondition,
43 preprocess_only=False, 44 preprocess_only=False,
44 allow_external_script=allow_external_script)) 45 allow_external_script=allow_external_script))
45 return self._flattened_data 46 return self._flattened_data
46 def MandatoryAttributes(self): 47 def MandatoryAttributes(self):
47 return ['name', 'type', 'file'] 48 return ['name', 'type', 'file']
48 49
49 def DefaultAttributes(self): 50 def DefaultAttributes(self):
50 return {'translateable' : 'true', 51 return {'translateable' : 'true',
51 'generateid': 'true', 52 'generateid': 'true',
52 'filenameonly': 'false', 53 'filenameonly': 'false',
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 node.StartParsing('include', parent) 169 node.StartParsing('include', parent)
169 node.HandleAttribute('name', name) 170 node.HandleAttribute('name', name)
170 node.HandleAttribute('type', type) 171 node.HandleAttribute('type', type)
171 node.HandleAttribute('file', file) 172 node.HandleAttribute('file', file)
172 node.HandleAttribute('translateable', translateable) 173 node.HandleAttribute('translateable', translateable)
173 node.HandleAttribute('filenameonly', filenameonly) 174 node.HandleAttribute('filenameonly', filenameonly)
174 node.HandleAttribute('mkoutput', mkoutput) 175 node.HandleAttribute('mkoutput', mkoutput)
175 node.HandleAttribute('relativepath', relativepath) 176 node.HandleAttribute('relativepath', relativepath)
176 node.EndParsing() 177 node.EndParsing()
177 return node 178 return node
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698