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