Mercurial > web-gnusto
comparison create_minified_files.py @ 76:4106de9f4871
Converted the SConstruct into a standard Python script; SCons is no longer a dependency of this project.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Wed, 21 May 2008 09:17:01 -0700 |
parents | SConstruct@027ce7e85594 |
children |
comparison
equal
deleted
inserted
replaced
75:027ce7e85594 | 76:4106de9f4871 |
---|---|
1 import os | |
2 import glob | |
3 | |
4 filenames = glob.glob("*.js") | |
5 | |
6 for filename in filenames: | |
7 basename, ext = os.path.splitext(filename) | |
8 if not basename.endswith(".min"): | |
9 print "Creating minified version of %s" % filename | |
10 os.system("python jsmin.py < %(SOURCE)s > %(TARGET)s" % ( | |
11 {"SOURCE" : filename, | |
12 "TARGET" : "%s.min%s" % (basename, ext)} | |
13 )) | |
14 | |
15 filenames = glob.glob("*.html") | |
16 | |
17 for filename in filenames: | |
18 basename, ext = os.path.splitext(filename) | |
19 if not basename.endswith(".min"): | |
20 print "Creating minified version of %s" % filename | |
21 newhtml = open(filename, "r").read().replace(".js", ".min.js") | |
22 open("%s.min%s" % (basename, ext), "w").write(newhtml) |