-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcompile_plugin_js.py
More file actions
22 lines (18 loc) · 966 Bytes
/
compile_plugin_js.py
File metadata and controls
22 lines (18 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os, argparse
read_files = ["i_am_a_widget", "api_endpoint", "clinput", "jct", "funders", "find_out_more", "feedback", "plugin"]
def compile(env=""):
with open(os.path.join("static", "js", "jct_plugin.js"), "w") as outfile:
for f in read_files:
if f == "api_endpoint" and env != "":
f = f + "_" + env
with open(os.path.join("static", "js", f + ".js"), "r") as infile:
print("reading... {}".format(f))
outfile.write("\n// -------- " + f + " --------\n\n")
outfile.write(infile.read())
outfile.write("\n\n")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Compile the widget')
parser.add_argument("-e", '--environment', type=str, default="",
help='environment to compile the widget for. No argument defaults to production')
args = parser.parse_args()
compile(args.environment)