diff --git a/nitro.config.ts b/nitro.config.ts index 7b20fb7..030cdae 100644 --- a/nitro.config.ts +++ b/nitro.config.ts @@ -1,6 +1,6 @@ //https://nitro.unjs.io/config export default defineNitroConfig({ - preset: "node", + preset: "vercel", devServer: { watch: ["./src/pages", "./src/components"], }, diff --git a/routes/[...index].ts b/routes/[...index].ts index eb41dfc..e5ba753 100644 --- a/routes/[...index].ts +++ b/routes/[...index].ts @@ -67,5 +67,14 @@ function doSetUp(html: string) { Object.assign(setupMap, new evalStore()); }); - return html.replace("{{name}}", setupMap["name"]); + const regex = /{{(.*?)}}/g; + var match; + + let matches = []; + while ((match = regex.exec(html)) != null) { + console.log(match[0], match[1]); + html = html.replace(match[0], setupMap[match[1]]); + } + + return html; } diff --git a/src/pages/index.html b/src/pages/index.html index b71e1cb..8e41f96 100644 --- a/src/pages/index.html +++ b/src/pages/index.html @@ -6,7 +6,7 @@