| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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() |
| OLD | NEW |