all repos — kushiyaki @ 2646e87b080448d9a1e1b75da65c1a8affec6195

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

insertJSX.js (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
import { visit } from "unist-util-visit";
import { select } from "hast-util-select";
export default function insertJSX(componentName, data = {}) {
  return async (tree) => {
    const fn = await import(`./input/templates/${componentName}.jsx`); //FIX avoid strict filestruct past "input"
    tree.children.unshift(fn.default(data));
  };
}