diff options
Diffstat (limited to 'services/nuldoc/nuldoc-src/commands/build.ts')
| -rw-r--r-- | services/nuldoc/nuldoc-src/commands/build.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/services/nuldoc/nuldoc-src/commands/build.ts b/services/nuldoc/nuldoc-src/commands/build.ts index 2b67d2b..2a9295d 100644 --- a/services/nuldoc/nuldoc-src/commands/build.ts +++ b/services/nuldoc/nuldoc-src/commands/build.ts @@ -41,6 +41,7 @@ export async function runBuildCommand(config: Config) { await copySlidesFiles(slides, config); await copyBlogAssetFiles(config); await copySlidesAssetFiles(config); + await copyPostSourceFiles(posts, config); } async function buildPostPages(config: Config): Promise<PostPage[]> { @@ -316,3 +317,16 @@ async function writePage(page: Page, config: Config) { await ensureDir(dirname(destFilePath)); await Deno.writeTextFile(destFilePath, render(page.root, page.renderer)); } + +async function copyPostSourceFiles(posts: PostPage[], config: Config) { + const cwd = Deno.cwd(); + const contentDir = join(cwd, config.locations.contentDir); + const destDir = join(cwd, config.locations.destDir, "blog"); + + for (const post of posts) { + const src = post.sourceFilePath; + const dst = join(destDir, relative(contentDir, src)); + await ensureDir(dirname(dst)); + await Deno.copyFile(src, dst); + } +} |
