diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-04-27 14:57:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-27 14:57:53 +0200 |
commit | 2a1f3c494421e1cf1a675be339dbe0227ebe28da (patch) | |
tree | ea64f39ae6ad575ecddd6fb4231313bb4710b235 /platform/javascript/emscripten_helpers.py | |
parent | 27548a36943a5ce98e30893524f54f7248e001c2 (diff) | |
parent | 88c060b00d53d1eb81a5f028bb187feb6118d5ff (diff) |
Merge pull request #48159 from Faless/js/4.x_pwa_export
[HTML5] Export as Progressive Web App
Diffstat (limited to 'platform/javascript/emscripten_helpers.py')
-rw-r--r-- | platform/javascript/emscripten_helpers.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/platform/javascript/emscripten_helpers.py b/platform/javascript/emscripten_helpers.py index b3b15a1574..ab98838e20 100644 --- a/platform/javascript/emscripten_helpers.py +++ b/platform/javascript/emscripten_helpers.py @@ -1,4 +1,4 @@ -import os +import os, json from SCons.Util import WhereIs @@ -59,7 +59,23 @@ def create_template_zip(env, js, wasm, extra): if env["tools"]: # HTML html = "#misc/dist/html/editor.html" - subst_dict = {"@GODOT_VERSION@": get_build_version(), "@GODOT_NAME@": "GodotEngine"} + cache = [ + "godot.tools.html", + "offline.html", + "godot.tools.js", + "godot.tools.worker.js", + "godot.tools.audio.worklet.js", + "logo.svg", + "favicon.png", + ] + opt_cache = ["godot.tools.wasm"] + subst_dict = { + "@GODOT_VERSION@": get_build_version(), + "@GODOT_NAME@": "GodotEngine", + "@GODOT_CACHE@": json.dumps(cache), + "@GODOT_OPT_CACHE@": json.dumps(opt_cache), + "@GODOT_OFFLINE_PAGE@": "offline.html", + } html = env.Substfile(target="#bin/godot${PROGSUFFIX}.html", source=html, SUBST_DICT=subst_dict) in_files.append(html) out_files.append(zip_dir.File(binary_name + ".html")) @@ -82,6 +98,10 @@ def create_template_zip(env, js, wasm, extra): # HTML in_files.append("#misc/dist/html/full-size.html") out_files.append(zip_dir.File(binary_name + ".html")) + in_files.append(service_worker) + out_files.append(zip_dir.File(binary_name + ".service.worker.js")) + in_files.append("#misc/dist/html/offline-export.html") + out_files.append(zip_dir.File("godot.offline.html")) zip_files = env.InstallAs(out_files, in_files) env.Zip( |