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));
}
|