view 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
line wrap: on
line source

import os
import glob

filenames = glob.glob("*.js")

for filename in filenames:
    basename, ext = os.path.splitext(filename)
    if not basename.endswith(".min"):
        Command("%s.min%s" % (basename, ext), filename,
                "python jsmin.py < ${SOURCE} > ${TARGET}")

filenames = glob.glob("*.html")

for filename in filenames:
    basename, ext = os.path.splitext(filename)
    if not basename.endswith(".min"):
        print "Creating minified version of %s" % filename
        newhtml = open(filename, "r").read().replace(".js", ".min.js")
        open("%s.min%s" % (basename, ext), "w").write(newhtml)