Mercurial > web-gnusto
annotate create_minified_files.py @ 93:817aa2851339 default tip
Added a very simple index.html.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Fri, 23 May 2008 03:50:44 -0700 |
parents | 4106de9f4871 |
children |
rev | line source |
---|---|
75
027ce7e85594
gnusto.html now includes all non-minified, non-packed JS by default. The SCons script now minifies all JS and creates a new gnusto.min.html file that includes all minified JS.
Atul Varma <varmaa@toolness.com>
parents:
74
diff
changeset
|
1 import os |
027ce7e85594
gnusto.html now includes all non-minified, non-packed JS by default. The SCons script now minifies all JS and creates a new gnusto.min.html file that includes all minified JS.
Atul Varma <varmaa@toolness.com>
parents:
74
diff
changeset
|
2 import glob |
027ce7e85594
gnusto.html now includes all non-minified, non-packed JS by default. The SCons script now minifies all JS and creates a new gnusto.min.html file that includes all minified JS.
Atul Varma <varmaa@toolness.com>
parents:
74
diff
changeset
|
3 |
027ce7e85594
gnusto.html now includes all non-minified, non-packed JS by default. The SCons script now minifies all JS and creates a new gnusto.min.html file that includes all minified JS.
Atul Varma <varmaa@toolness.com>
parents:
74
diff
changeset
|
4 filenames = glob.glob("*.js") |
027ce7e85594
gnusto.html now includes all non-minified, non-packed JS by default. The SCons script now minifies all JS and creates a new gnusto.min.html file that includes all minified JS.
Atul Varma <varmaa@toolness.com>
parents:
74
diff
changeset
|
5 |
027ce7e85594
gnusto.html now includes all non-minified, non-packed JS by default. The SCons script now minifies all JS and creates a new gnusto.min.html file that includes all minified JS.
Atul Varma <varmaa@toolness.com>
parents:
74
diff
changeset
|
6 for filename in filenames: |
027ce7e85594
gnusto.html now includes all non-minified, non-packed JS by default. The SCons script now minifies all JS and creates a new gnusto.min.html file that includes all minified JS.
Atul Varma <varmaa@toolness.com>
parents:
74
diff
changeset
|
7 basename, ext = os.path.splitext(filename) |
027ce7e85594
gnusto.html now includes all non-minified, non-packed JS by default. The SCons script now minifies all JS and creates a new gnusto.min.html file that includes all minified JS.
Atul Varma <varmaa@toolness.com>
parents:
74
diff
changeset
|
8 if not basename.endswith(".min"): |
76
4106de9f4871
Converted the SConstruct into a standard Python script; SCons is no longer a dependency of this project.
Atul Varma <varmaa@toolness.com>
parents:
75
diff
changeset
|
9 print "Creating minified version of %s" % filename |
4106de9f4871
Converted the SConstruct into a standard Python script; SCons is no longer a dependency of this project.
Atul Varma <varmaa@toolness.com>
parents:
75
diff
changeset
|
10 os.system("python jsmin.py < %(SOURCE)s > %(TARGET)s" % ( |
4106de9f4871
Converted the SConstruct into a standard Python script; SCons is no longer a dependency of this project.
Atul Varma <varmaa@toolness.com>
parents:
75
diff
changeset
|
11 {"SOURCE" : filename, |
4106de9f4871
Converted the SConstruct into a standard Python script; SCons is no longer a dependency of this project.
Atul Varma <varmaa@toolness.com>
parents:
75
diff
changeset
|
12 "TARGET" : "%s.min%s" % (basename, ext)} |
4106de9f4871
Converted the SConstruct into a standard Python script; SCons is no longer a dependency of this project.
Atul Varma <varmaa@toolness.com>
parents:
75
diff
changeset
|
13 )) |
75
027ce7e85594
gnusto.html now includes all non-minified, non-packed JS by default. The SCons script now minifies all JS and creates a new gnusto.min.html file that includes all minified JS.
Atul Varma <varmaa@toolness.com>
parents:
74
diff
changeset
|
14 |
027ce7e85594
gnusto.html now includes all non-minified, non-packed JS by default. The SCons script now minifies all JS and creates a new gnusto.min.html file that includes all minified JS.
Atul Varma <varmaa@toolness.com>
parents:
74
diff
changeset
|
15 filenames = glob.glob("*.html") |
027ce7e85594
gnusto.html now includes all non-minified, non-packed JS by default. The SCons script now minifies all JS and creates a new gnusto.min.html file that includes all minified JS.
Atul Varma <varmaa@toolness.com>
parents:
74
diff
changeset
|
16 |
027ce7e85594
gnusto.html now includes all non-minified, non-packed JS by default. The SCons script now minifies all JS and creates a new gnusto.min.html file that includes all minified JS.
Atul Varma <varmaa@toolness.com>
parents:
74
diff
changeset
|
17 for filename in filenames: |
027ce7e85594
gnusto.html now includes all non-minified, non-packed JS by default. The SCons script now minifies all JS and creates a new gnusto.min.html file that includes all minified JS.
Atul Varma <varmaa@toolness.com>
parents:
74
diff
changeset
|
18 basename, ext = os.path.splitext(filename) |
027ce7e85594
gnusto.html now includes all non-minified, non-packed JS by default. The SCons script now minifies all JS and creates a new gnusto.min.html file that includes all minified JS.
Atul Varma <varmaa@toolness.com>
parents:
74
diff
changeset
|
19 if not basename.endswith(".min"): |
027ce7e85594
gnusto.html now includes all non-minified, non-packed JS by default. The SCons script now minifies all JS and creates a new gnusto.min.html file that includes all minified JS.
Atul Varma <varmaa@toolness.com>
parents:
74
diff
changeset
|
20 print "Creating minified version of %s" % filename |
027ce7e85594
gnusto.html now includes all non-minified, non-packed JS by default. The SCons script now minifies all JS and creates a new gnusto.min.html file that includes all minified JS.
Atul Varma <varmaa@toolness.com>
parents:
74
diff
changeset
|
21 newhtml = open(filename, "r").read().replace(".js", ".min.js") |
027ce7e85594
gnusto.html now includes all non-minified, non-packed JS by default. The SCons script now minifies all JS and creates a new gnusto.min.html file that includes all minified JS.
Atul Varma <varmaa@toolness.com>
parents:
74
diff
changeset
|
22 open("%s.min%s" % (basename, ext), "w").write(newhtml) |