Selaa lähdekoodia

script to build web distribution

Chris Mullins 8 vuotta sitten
vanhempi
commit
4440a0320f
2 muutettua tiedostoa jossa 33 lisäystä ja 0 poistoa
  1. 31 0
      .build_web.py
  2. 2 0
      dist/index.html.gz.h

+ 31 - 0
.build_web.py

@@ -0,0 +1,31 @@
+from shutil import copyfile
+from subprocess import check_output
+import sys
+import os
+import platform
+import subprocess
+
+Import("env")
+
+def is_tool(name):
+    cmd = "where" if platform.system() == "Windows" else "which"
+    try:
+        check_output([cmd, name])
+        return True
+    except:
+        return False;
+
+if is_tool("npm"):
+    os.chdir("web")
+    print("Attempting to build webpage...")
+    try:
+        print check_output(["npm", "install"])
+        print check_output(["node_modules/.bin/gulp"])
+        copyfile("build/index.html.gz.h", "../dist/index.html.gz.h")
+
+    except Exception as e:
+        print "Encountered error building webpage: ", e
+        print "WARNING: Failed to build web package. Using pre-built page."
+        pass
+    finally:
+        os.chdir("..");

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 2 - 0
dist/index.html.gz.h