annotate SConstruct @ 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.
author Atul Varma <varmaa@toolness.com>
date Wed, 21 May 2008 07:22:50 -0700
parents d449d74a1f96
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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"):
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
9 Command("%s.min%s" % (basename, ext), 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
10 "python jsmin.py < ${SOURCE} > ${TARGET}")
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
11
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
12 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
13
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 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
15 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
16 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
17 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
18 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
19 open("%s.min%s" % (basename, ext), "w").write(newhtml)