looper.js (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import { extractFrontmatter } from "./extractFrontmatter";
import { writePage } from "./writePage";
import { copy, emptyDir, ensureDir, writeFile, readdir } from "fs-extra";
import cpy from "cpy";
import glob from "glob";
//mise en place
await emptyDir("out/", { recursive: true }); // clears the output folder
await ensureDir("out/assets");
await cpy("./input/assets", "./out/assets", { flat: true });
const contentDir = await glob("./input/content/", {
nodir: true,
withFileTypes: true,
});
await Promise.all(
contentDir
.filter((f) => f.isFile())
.map((f) => console.log(extractFrontmatter(f.path))),
);
// for (let file of contentDir) {
// if (file.isFile()) {
// console.log(await extractFrontmatter(file.path));
// }
// }
// async function indexSite() {
// const
// return
// }
|