From a97e72f2192ebb07c221acd4bb39840d10ac2c49 Mon Sep 17 00:00:00 2001
From: Bartłomiej Garbiec <garbiec@bartek.me>
Date: Mon, 20 May 2024 19:36:32 +0000
Subject: [PATCH] i18n: add Polish translation (#1148)

---
 quartz/plugins/index.ts |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/quartz/plugins/index.ts b/quartz/plugins/index.ts
index f35d053..554b117 100644
--- a/quartz/plugins/index.ts
+++ b/quartz/plugins/index.ts
@@ -18,6 +18,23 @@
     }
   }
 
+  // if serving locally, listen for rebuilds and reload the page
+  if (ctx.argv.serve) {
+    const wsUrl = ctx.argv.remoteDevHost
+      ? `wss://${ctx.argv.remoteDevHost}:${ctx.argv.wsPort}`
+      : `ws://localhost:${ctx.argv.wsPort}`
+
+    staticResources.js.push({
+      loadTime: "afterDOMReady",
+      contentType: "inline",
+      script: `
+            const socket = new WebSocket('${wsUrl}')
+            // reload(true) ensures resources like images and scripts are fetched again in firefox
+            socket.addEventListener('message', () => document.location.reload(true))
+          `,
+    })
+  }
+
   return staticResources
 }
 

--
Gitblit v1.10.0