Mercurial > web-gnusto
view 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 |
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"): print "Creating minified version of %s" % filename os.system("python jsmin.py < %(SOURCE)s > %(TARGET)s" % ( {"SOURCE" : filename, "TARGET" : "%s.min%s" % (basename, ext)} )) 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)