From 0bf6c1feff0532c306aece1994e04c377bbfc7ee Mon Sep 17 00:00:00 2001 From: Simon Lecoq <22963968+lowlighter@users.noreply.github.com> Date: Mon, 10 Jun 2024 04:32:28 +0200 Subject: [PATCH] refactor: vendor highlight.js --- app/build/ssg.ts | 6 ++++++ app/mod.html | 2 +- app/mod.ts | 4 +++- deno.jsonc | 9 ++++++++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/build/ssg.ts b/app/build/ssg.ts index 6c38e29..7281daa 100644 --- a/app/build/ssg.ts +++ b/app/build/ssg.ts @@ -5,6 +5,9 @@ import { root } from "./root.ts" import { html, html_builder, html_builder_demo } from "./html.ts" import { compatibility } from "jsr:@libs/bundle@5/css" +/** Highlight.js CDN */ +export const highlight = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" + /** Static site generation */ export async function ssg() { await emptyDir(new URL(".pages", root)) @@ -52,5 +55,8 @@ export async function ssg() { console.log(`Created .pages/${alias}`) } } + // Download highlight.js + await Deno.writeTextFile(new URL(".pages/highlight.js", root), await fetch(highlight).then((response) => response.text())) + console.log("Created .pages/highlight.js") console.log("Done!") } diff --git a/app/mod.html b/app/mod.html index 709c086..7151e6f 100644 --- a/app/mod.html +++ b/app/mod.html @@ -13,7 +13,7 @@ - +