all repos — kushiyaki @ 105a5c68574814d737ceb68a86d1dc45cfca7728

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