mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
have build toggle for offline support
This commit is contained in:
parent
e3719b2527
commit
453e6e1e0c
@ -15,6 +15,7 @@ const projectDir = path.join(__dirname, "../");
|
|||||||
const targetDir = path.join(projectDir, "target");
|
const targetDir = path.join(projectDir, "target");
|
||||||
|
|
||||||
const debug = true;
|
const debug = true;
|
||||||
|
const offline = true;
|
||||||
|
|
||||||
async function build() {
|
async function build() {
|
||||||
// get version number
|
// get version number
|
||||||
@ -26,7 +27,9 @@ async function build() {
|
|||||||
await buildHtml();
|
await buildHtml();
|
||||||
await buildJs();
|
await buildJs();
|
||||||
await buildCss();
|
await buildCss();
|
||||||
await buildOffline(version);
|
if (offline) {
|
||||||
|
await buildOffline(version);
|
||||||
|
}
|
||||||
|
|
||||||
console.log(`built brawl ${version} successfully`);
|
console.log(`built brawl ${version} successfully`);
|
||||||
}
|
}
|
||||||
@ -42,8 +45,10 @@ async function buildHtml() {
|
|||||||
removeOrEnableScript(doc("script#phone-debug-pre"), debug);
|
removeOrEnableScript(doc("script#phone-debug-pre"), debug);
|
||||||
removeOrEnableScript(doc("script#phone-debug-post"), debug);
|
removeOrEnableScript(doc("script#phone-debug-post"), debug);
|
||||||
removeOrEnableScript(doc("script#service-worker"), false);
|
removeOrEnableScript(doc("script#service-worker"), false);
|
||||||
doc("html").attr("manifest", "manifest.appcache");
|
if (offline) {
|
||||||
doc("head").append(`<link rel="manifest" href="manifest.json">`);
|
doc("html").attr("manifest", "manifest.appcache");
|
||||||
|
doc("head").append(`<link rel="manifest" href="manifest.json">`);
|
||||||
|
}
|
||||||
await fs.writeFile(path.join(targetDir, "index.html"), doc.html(), "utf8");
|
await fs.writeFile(path.join(targetDir, "index.html"), doc.html(), "utf8");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user