|
|
@@ -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
|