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

Side by Side Diff: Source/devtools/scripts/inline_js_imports.py

Issue 252633006: Compact JS resource better by using rjsmin. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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 # 2 #
3 # Copyright (C) 2011 Google Inc. All rights reserved. 3 # Copyright (C) 2011 Google Inc. All rights reserved.
4 # 4 #
5 # Redistribution and use in source and binary forms, with or without 5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are 6 # modification, are permitted provided that the following conditions are
7 # met: 7 # met:
8 # 8 #
9 # * Redistributions of source code must retain the above copyright 9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer. 10 # notice, this list of conditions and the following disclaimer.
(...skipping 16 matching lines...) Expand all
27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 # 30 #
31 31
32 # This script replaces calls to importScripts with script sources 32 # This script replaces calls to importScripts with script sources
33 # in input script file and dumps result into output script file. 33 # in input script file and dumps result into output script file.
34 34
35 from cStringIO import StringIO 35 from cStringIO import StringIO
36 36
37 import rjsmin
38 import os.path 37 import os.path
39 import re 38 import re
40 import sys 39 import sys
41 40
41 rjsmin_path = os.path.abspath(os.path.join(
42 os.path.dirname(__file__),
43 "..",
44 "..",
45 "build",
46 "scripts"))
47 sys.path.append(rjsmin_path)
48 import rjsmin
42 49
43 def main(argv): 50 def main(argv):
44 51
45 if len(argv) < 3: 52 if len(argv) < 3:
46 print('usage: %s input_file imports_dir output_file no_minify' % argv[0] ) 53 print('usage: %s input_file imports_dir output_file no_minify' % argv[0] )
47 return 1 54 return 1
48 55
49 input_file_name = argv[1] 56 input_file_name = argv[1]
50 imports_dir = argv[2] 57 imports_dir = argv[2]
51 output_file_name = argv[3] 58 output_file_name = argv[3]
(...skipping 30 matching lines...) Expand all
82 output_file.close() 89 output_file.close()
83 90
84 # Touch output file directory to make sure that Xcode will copy 91 # Touch output file directory to make sure that Xcode will copy
85 # modified resource files. 92 # modified resource files.
86 if sys.platform == 'darwin': 93 if sys.platform == 'darwin':
87 output_dir_name = os.path.dirname(output_file_name) 94 output_dir_name = os.path.dirname(output_file_name)
88 os.utime(output_dir_name, None) 95 os.utime(output_dir_name, None)
89 96
90 if __name__ == '__main__': 97 if __name__ == '__main__':
91 sys.exit(main(sys.argv)) 98 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698