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

Side by Side Diff: chrome/browser/resources/vulcanize.py

Issue 2371383003: MD Downloads/History: make javascript uglier and more compact (Closed)
Patch Set: merge Created 4 years, 2 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
« no previous file with comments | « chrome/browser/resources/md_history/lazy_load.vulcanized.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 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 import os 6 import os
7 import subprocess 7 import subprocess
8 import sys 8 import sys
9 import tempfile 9 import tempfile
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 try: 82 try:
83 _run_cmd(['crisper', '--source', tmp.name, 83 _run_cmd(['crisper', '--source', tmp.name,
84 '--script-in-head', 'false', 84 '--script-in-head', 'false',
85 '--html', html_out_path, 85 '--html', html_out_path,
86 '--js', js_out_path]) 86 '--js', js_out_path])
87 87
88 # TODO(tsergeant): Remove when JS resources are minified by default: 88 # TODO(tsergeant): Remove when JS resources are minified by default:
89 # crbug.com/619091. 89 # crbug.com/619091.
90 _run_cmd(['uglifyjs', js_out_path, 90 _run_cmd(['uglifyjs', js_out_path,
91 '--beautify', 'indent-level=2,quote_style=3',
92 '--comments', '/Copyright|license|LICENSE|\<\/?if/', 91 '--comments', '/Copyright|license|LICENSE|\<\/?if/',
93 '--output', js_out_path]) 92 '--output', js_out_path])
94 finally: 93 finally:
95 os.remove(tmp.name) 94 os.remove(tmp.name)
96 95
97 96
98 def _css_build(directory, files): 97 def _css_build(directory, files):
99 target_path = os.path.join(_HERE_PATH, directory) 98 target_path = os.path.join(_HERE_PATH, directory)
100 paths = map(lambda f: os.path.join(target_path, f), files) 99 paths = map(lambda f: os.path.join(target_path, f), files)
101 100
(...skipping 18 matching lines...) Expand all
120 _vulcanize(directory='md_history', host='history', 119 _vulcanize(directory='md_history', host='history',
121 html_in_file='lazy_load.html', 120 html_in_file='lazy_load.html',
122 html_out_file='lazy_load.vulcanized.html', 121 html_out_file='lazy_load.vulcanized.html',
123 js_out_file='lazy_load.crisper.js', 122 js_out_file='lazy_load.crisper.js',
124 extra_args=history_extra_args + lazy_load_extra_args) 123 extra_args=history_extra_args + lazy_load_extra_args)
125 _css_build(directory='md_history', files=['app.vulcanized.html', 124 _css_build(directory='md_history', files=['app.vulcanized.html',
126 'lazy_load.vulcanized.html']) 125 'lazy_load.vulcanized.html'])
127 126
128 if __name__ == '__main__': 127 if __name__ == '__main__':
129 main() 128 main()
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_history/lazy_load.vulcanized.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698