all repos — kushiyaki @ 4bb8cf16bf94ddbed895c506f82ba60ea9e2df9f

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

writeComponent.js (view raw)

 1
 2
 3
 4
 5
 6
 7
import { unified } from "unified";
import rehypeStringify from "rehype-stringify";

export async function writeComponent(componentName, data = {}) {
  const fn = await import(`./input/templates/${componentName}.jsx`); //FIX avoid strict filestruct past "input"
  return unified().use(rehypeStringify).stringify(fn.default(data));
}