-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from sidoh/embedded_web
Embed website in firmware rather than storing it separately in SPIFFS
- Loading branch information
Showing
34 changed files
with
1,247 additions
and
3,092 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
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; | ||
|
||
def pre_build(source, target, env): | ||
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(".."); | ||
|
||
env.Execute(pre_build) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
.piolibdeps | ||
.clang_complete | ||
.gcc-flags.json | ||
/dist | ||
/web/node_modules | ||
/web/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.