From 70f82c86f3cae12e63ea004310f67d7474c0a7cf Mon Sep 17 00:00:00 2001 From: Tim Clulow Date: Wed, 15 May 2024 16:08:31 +0900 Subject: [PATCH] added watch task in dev mode, had to rename files to mjs so that eleventy doesnt get confused --- deno.json | 7 +- eleventy.config.js | 20 ------ server/write-data.ts | 2 +- src/_data/likes.js | 3 - src/_data/meta.js | 9 --- src/_includes/webc/c-header.webc | 106 ++++++++++++++++--------------- src/content/content.11tydata.js | 16 ----- src/src.11tydata.js | 16 ----- 8 files changed, 59 insertions(+), 120 deletions(-) delete mode 100644 eleventy.config.js delete mode 100644 src/_data/likes.js delete mode 100644 src/_data/meta.js delete mode 100644 src/content/content.11tydata.js delete mode 100644 src/src.11tydata.js diff --git a/deno.json b/deno.json index 2c2160f..ce46762 100644 --- a/deno.json +++ b/deno.json @@ -1,12 +1,13 @@ { "tasks": { "clean": "rm -rf _site", - "writeKVData": "deno run --allow-write --unstable-kv server/write-data.ts", + "dev": "deno task writeKVData && deno task generateSlim && deno task eleventyWatch & deno run --watch --allow-net --allow-read --unstable-kv server/main.ts", + "eleventyWatch": "deno run --allow-sys --allow-run --allow-read --allow-write --allow-env npm:@11ty/eleventy@canary --watch", "generate": "deno task clean && deno run --allow-read --allow-write --allow-env --allow-sys npm:@11ty/eleventy@canary", "generateSlim": "LAYOUT=slim deno run --allow-read --allow-write --allow-env --allow-sys npm:@11ty/eleventy@canary", "tscheck": "deno check server/main.ts", - "dev": "deno task writeKVData && deno task generate && deno task generateSlim && deno run --watch --allow-net --allow-read --unstable-kv server/main.ts", - "prod": "deno task writeKVData && deno task generate && deno task generateSlim" + "prod": "deno task writeKVData && deno task generate && deno task generateSlim", + "writeKVData": "deno run --allow-write --unstable-kv server/write-data.ts" }, "imports": { "@11ty/eleventy": "npm:@11ty/eleventy@canary", diff --git a/eleventy.config.js b/eleventy.config.js deleted file mode 100644 index 8789572..0000000 --- a/eleventy.config.js +++ /dev/null @@ -1,20 +0,0 @@ -// Eleventy 3! -import pluginWebc from "npm:@11ty/eleventy-plugin-webc"; -import { EleventyRenderPlugin } from "npm:@11ty/eleventy@canary"; - -export default function(eleventyConfig) { - - eleventyConfig.addPassthroughCopy("./src/css/*.css"); - eleventyConfig.addPlugin(EleventyRenderPlugin); - eleventyConfig.addPlugin(pluginWebc,{ - components: "src/_includes/webc/**/*.webc", - }); - - return { - htmlTemplateEngine: "njk", - dir: { - input: "src", - output: "_site" - } - } -}; \ No newline at end of file diff --git a/server/write-data.ts b/server/write-data.ts index a91a730..970e890 100644 --- a/server/write-data.ts +++ b/server/write-data.ts @@ -16,4 +16,4 @@ const data = `export default { likes: ${likes} }`; -await Deno.writeTextFile("./src/_data/likes.js", data); \ No newline at end of file +await Deno.writeTextFile("./src/_data/likes.mjs", data); \ No newline at end of file diff --git a/src/_data/likes.js b/src/_data/likes.js deleted file mode 100644 index f2b7c25..0000000 --- a/src/_data/likes.js +++ /dev/null @@ -1,3 +0,0 @@ -export default { - likes: 0 -} \ No newline at end of file diff --git a/src/_data/meta.js b/src/_data/meta.js deleted file mode 100644 index 6d3153f..0000000 --- a/src/_data/meta.js +++ /dev/null @@ -1,9 +0,0 @@ -export default { - // NOTE: `process.env.URL` is provided by Netlify, and may need - // adjusted pending your host - url: Deno.env.get("Host") || "http://localhost:8080", - siteName: "11ty deno htmx", - siteDescription: "", - authorName: "", - twitterUsername: "", // no `@` -}; \ No newline at end of file diff --git a/src/_includes/webc/c-header.webc b/src/_includes/webc/c-header.webc index ebc6bcd..a342c71 100644 --- a/src/_includes/webc/c-header.webc +++ b/src/_includes/webc/c-header.webc @@ -1,58 +1,60 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + +
diff --git a/src/content/content.11tydata.js b/src/content/content.11tydata.js deleted file mode 100644 index 30fd66f..0000000 --- a/src/content/content.11tydata.js +++ /dev/null @@ -1,16 +0,0 @@ -const environmentVars = () => { - if ( Deno.env.get("LAYOUT") === "slim"){ - return { - layout: "nolayout.njk", - permalink: "/{{ title | slugify }}/slim.html" - } - } - else { - return { - layout: "layout.njk", - permalink: "/{{ title | slugify }}/" - } - } -}; - -export default environmentVars \ No newline at end of file diff --git a/src/src.11tydata.js b/src/src.11tydata.js deleted file mode 100644 index a1211dd..0000000 --- a/src/src.11tydata.js +++ /dev/null @@ -1,16 +0,0 @@ -const environmentVars = () => { - if ( Deno.env.get("LAYOUT") === "slim"){ - return { - layout: "nolayout.njk", - permalink: "/slim.html" - } - } - else { - return { - layout: "layout.njk", - permalink: "/" - } - } -}; - -export default environmentVars \ No newline at end of file