From ff4a917800d99f792a006d12107ea901670e55df Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 9 Mar 2023 01:13:36 +0900 Subject: nuldoc: copy static files on build --- nuldoc-src/command.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'nuldoc-src') diff --git a/nuldoc-src/command.ts b/nuldoc-src/command.ts index 7495427..47b8ee0 100644 --- a/nuldoc-src/command.ts +++ b/nuldoc-src/command.ts @@ -13,6 +13,7 @@ export async function run(config: Config) { const posts = await generatePosts(config); await generateTags(posts, config); await generatePostList(posts, config); + await copyStaticFiles(config); } async function generatePosts(config: Config) { @@ -140,3 +141,12 @@ async function outputTags(tagDocs: [string, Document][], config: Config) { await writeHtmlFile(tagDoc, destFilePath); } } + +async function copyStaticFiles(config: Config) { + const globPattern = joinGlobs([Deno.cwd(), config.locations.staticDir, "*"]); + for await (const entry of expandGlob(globPattern)) { + const src = entry.path; + const dst = src.replace(config.locations.staticDir, config.locations.destDir); + await Deno.copyFile(src, dst); + } +} -- cgit v1.2.3-70-g09d2