forked from RunestoneInteractive/RunestoneServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
minifyjs.py
executable file
·49 lines (42 loc) · 1.52 KB
/
minifyjs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/local/bin/python
from subprocess import call
import sys
outdir = sys.argv[1] + "/_static/"
filenames = [outdir + "activecode.js",
outdir + "animationbase.js",
outdir + "assess.js",
outdir + "bookfuncs.js",
outdir + "bootstrap-sphinx.js",
outdir + "codemirror.js",
outdir + "doctools.js",
outdir + "edu-python.js",
outdir + "guiders-1.3.0.js",
outdir + "jquery.highlight.js",
outdir + "jquery.idle-timer.js",
outdir + "navhelp.js",
outdir + "poll.js",
outdir + "python.js",
outdir + "rangy-cssclassapplier.js",
outdir + "searchtools.js",
outdir + "sortmodels.js",
outdir + "sortviewers.js",
outdir + "user-highlights.js",
outdir + "websupport.js",
outdir + "lib/lis.js",
outdir + "lib/prettify.js",
outdir + "js/jquery.corner.js",
outdir + "js/opt-frontend.js",
outdir + "js/opt-lessons.js",
outdir + "js/pytutor.js"]
for filename in filenames:
print "Minifying " + filename
call(["mv", filename, "a.js"])
call(["java",
"-jar", "closure-compiler.jar",
"--js", "a.js",
"--js_output_file", filename,
"--compilation_level", "SIMPLE_OPTIMIZATIONS",
"--warning_level", "QUIET",
"--jscomp_off", "internetExplorerChecks"])
call(["rm", "a.js"])
print "Done."