all repos — kushiyaki @ 587d1182cf8f63818048daaa05ccf5e6b3887d9e

🍢 A tiny static site generator for grilling markdown files to perfection

looper.js (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
import { emptyDir, writeFile } from "fs-extra";
import { joinComponents } from "./joinComponents";
import cpy from "cpy";
import { glob } from "glob";

//mise en place
await emptyDir("out", { recursive: true }); // clears the output folder
await cpy("input/assets", "out", { flat: true }); //copies all the assets into out/

for (const file of await glob("input/content/**/*", { nodir: true })) {
  console.log(file);
  await writeFile(
    file.replace("input/content", "out").replace(".md", ".html"),
    await joinComponents(file),
  );
}