提交 99106199 编写于 作者: M Mr.doob

Added --amd parameter to build.py

上级 6299cd2a
......@@ -19,6 +19,7 @@ def main(argv=None):
parser = argparse.ArgumentParser()
parser.add_argument('--include', action='append', required=True)
parser.add_argument('--externs', action='append', default=['externs/common.js'])
parser.add_argument('--amd', action='store_true', default=False)
parser.add_argument('--minify', action='store_true', default=False)
parser.add_argument('--output', default='../../build/three.js')
parser.add_argument('--sourcemaps', action='store_true', default=False)
......@@ -44,6 +45,9 @@ def main(argv=None):
tmp = open(path, 'w')
sources = []
if args.amd:
tmp.write('( function ( root, factory ) {\n\n\tif ( typeof define === \'function\' && define.amd ) {\n\n\t\tdefine( factory );\n\n\t} else {\n\n\t\troot.THREE = factory();\n\n\t}\n\n}( this, function () {\n\n')
for include in args.include:
with open('includes/' + include + '.json','r') as f:
files = json.load(f)
......@@ -54,6 +58,9 @@ def main(argv=None):
tmp.write(f.read())
tmp.write('\n')
if args.amd:
tmp.write('return THREE;\n\n} ) );')
tmp.close()
# save
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册