From 37f1bc92e03ca90a0e52cc52ff2f797934a201da Mon Sep 17 00:00:00 2001
From: Sam Therapy <sam@samtherapy.net>
Date: Thu, 13 Oct 2022 19:14:58 +0200
Subject: [PATCH] I live in Spain but the S is silent

Signed-off-by: Sam Therapy <sam@samtherapy.net>
---
 .drone.yml                     |  2 +-
 .vscode/settings.json          |  4 ----
 _config.ts                     | 26 ++++++++++++++++++--------
 import_map.json                |  2 +-
 server.ts                      |  9 +++++++--
 src/_includes/layouts/base.tsx |  9 +--------
 src/_includes/styles/base.scss |  2 +-
 src/_site.json                 |  5 -----
 8 files changed, 29 insertions(+), 30 deletions(-)
 delete mode 100644 src/_site.json

diff --git a/.drone.yml b/.drone.yml
index 053fba2..80c7c36 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -24,7 +24,7 @@ steps:
       DENO_DEPLOY_TOKEN:
         from_secret: DENO_DEPLOY_TOKEN
     settings:
-      project: samme-blog
+      project: samme
       entrypoint: server.ts
       production: true
       include: dist,server.ts
diff --git a/.vscode/settings.json b/.vscode/settings.json
index d2a68f6..9ab804a 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -6,8 +6,4 @@
   "[typescript]": {
     "editor.defaultFormatter": "denoland.vscode-deno"
   },
-  "deno.suggest.imports.hosts": {
-    "https://deno.land": true,
-    "https://esm.sh": true
-  }
 }
diff --git a/_config.ts b/_config.ts
index 91327ac..7f4d3ea 100644
--- a/_config.ts
+++ b/_config.ts
@@ -1,33 +1,43 @@
 import lume from "lume/mod.ts";
+
+// Stable plugins
 import attributes from "lume/plugins/attributes.ts";
 import codeHighlight from "lume/plugins/code_highlight.ts";
 import date from "lume/plugins/date.ts";
+import esbuild from "lume/plugins/esbuild.ts"
 import jsx_preact from "lume/plugins/jsx_preact.ts";
-// import lightningcss from "lume/plugins/lightningcss.ts";
+import lightningcss from "lume/plugins/lightningcss.ts";
+import minifyHTML from "lume/plugins/minify_html.ts";
 import sass from "lume/plugins/sass.ts";
-import sitemap from "sitemap";
 import svgo from "lume/plugins/svgo.ts";
 
+// Experimental plugins
+import mdx from "experimental/mdx/mod.ts"
+import sitemap from "experimental/sitemap/sitemap.ts";
+
 const site = lume({
   src: "./src",
   dest: "./dist",
-  location: new URL("https://samtherapy.net")
+  location: new URL("https://samtherapy.net"),
 });
 
 site
   .copy("img")
   .copy(".well-known")
   .use(attributes())
+  .use(codeHighlight())
   .use(date())
   .use(jsx_preact())
-  // .use(mdx())
-  .use(sass({ extensions: [".scss"] }))
-  .use(codeHighlight())
-  // .use(lightningcss())
+  .use(mdx())
   .use(sitemap())
   .use(svgo())
   .remoteFile(
     "_includes/styles/external/nord.min.css",
     "https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.6.0/build/styles/nord.min.css",
-  );
+)
+  .use(esbuild())
+  .use(lightningcss())
+  .use(sass({ extensions: [ ".scss" ] }))
+  .use(minifyHTML())
+ 
 export default site;
diff --git a/import_map.json b/import_map.json
index b0835cb..1d6100a 100644
--- a/import_map.json
+++ b/import_map.json
@@ -3,6 +3,6 @@
     "lume/": "https://deno.land/x/lume@v1.12.0/",
     "preact/jsx-runtime": "https://deno.land/x/lume@v1.12.0/deps/preact_runtime.ts",
     "preact": "https://deno.land/x/lume@v1.12.0/deps/preact.ts",
-    "sitemap": "https://raw.githubusercontent.com/lumeland/experimental-plugins/main/sitemap/sitemap.ts"
+    "experimental/": "https://raw.githubusercontent.com/lumeland/experimental-plugins/main/"
   }
 }
diff --git a/server.ts b/server.ts
index 538bab7..ed81b70 100644
--- a/server.ts
+++ b/server.ts
@@ -1,7 +1,12 @@
-import { Application, httpErrors, Router } from "https://deno.land/x/oak@v11.1.0/mod.ts";
+import { Application, Router } from "https://deno.land/x/oak@v11.1.0/mod.ts";
 
 const app = new Application();
 
+app.addEventListener("error", (evt) => {
+  // Will log the thrown error to the console.
+  console.dir(evt.error);
+});
+
 // First we try to serve static files from the dist folder. If that fails, we
 // fall through to the router below.
 app.use(async (ctx, next) => {
@@ -12,7 +17,7 @@ app.use(async (ctx, next) => {
   }).catch(async () => {
     ctx.response.status = 404
     ctx.response.body = await Deno.readTextFile(`${Deno.cwd()}/dist/404.html`);
-    next();
+    await next();
   });
 });
 
diff --git a/src/_includes/layouts/base.tsx b/src/_includes/layouts/base.tsx
index d1671ac..d2429e7 100644
--- a/src/_includes/layouts/base.tsx
+++ b/src/_includes/layouts/base.tsx
@@ -9,19 +9,12 @@ export default ({ title, children }: PageData) => (
     <head>
       <meta charSet="utf-8" />
       <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-
       <title>{title}</title>
-
       <link rel="shortcut icon" href="img/favicon.png" />
       <link rel="stylesheet" href="/styles/style.css" />
     </head>
     <body>
-      {
-        /* <header>
-        {/* <Navbar />
-      </header> */
-      }
-      <main>
+      <main class="container">
         {children}
       </main>
     </body>
diff --git a/src/_includes/styles/base.scss b/src/_includes/styles/base.scss
index eba461d..fa0b708 100644
--- a/src/_includes/styles/base.scss
+++ b/src/_includes/styles/base.scss
@@ -1,5 +1,5 @@
 // Imports
-@use "styles/external/pico/scss/pico.classless"; // Pico Framework
+@use "styles/external/pico/scss/pico"; // Pico Framework
 @use "styles/external/nord.min"; // Highlight.js
 
 // Font
diff --git a/src/_site.json b/src/_site.json
deleted file mode 100644
index a8d8fd8..0000000
--- a/src/_site.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-  "info": {
-    "title": "samtherapy.net"
-  }
-}
