OLD | NEW |
1 #!/usr/bin/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 ''' Javascript minifier using the closure compiler | 5 ''' Javascript minifier using the closure compiler |
6 | 6 |
7 This minifier strips spaces and comments out of Javascript using the closure | 7 This minifier strips spaces and comments out of Javascript using the closure |
8 compiler. It takes the original Javascript on standard input, and outputs | 8 compiler. It takes the original Javascript on standard input, and outputs |
9 the minified output on standard output. | 9 the minified output on standard output. |
10 | 10 |
11 Any errors or other messages from the compiler are output on standard error. | 11 Any errors or other messages from the compiler are output on standard error. |
(...skipping 29 matching lines...) Expand all Loading... |
41 | 41 |
42 if __name__ == '__main__': | 42 if __name__ == '__main__': |
43 orig_stdout = sys.stdout | 43 orig_stdout = sys.stdout |
44 result = '' | 44 result = '' |
45 try: | 45 try: |
46 sys.stdout = sys.stderr | 46 sys.stdout = sys.stderr |
47 result = Minify(sys.stdin.read()) | 47 result = Minify(sys.stdin.read()) |
48 finally: | 48 finally: |
49 sys.stdout = orig_stdout | 49 sys.stdout = orig_stdout |
50 print result | 50 print result |
OLD | NEW |