ziko-wrapper
Version:
integrate zikojs elements within other ui framework like vue react solidjs svelte astro ...
25 lines (24 loc) • 730 B
JavaScript
import { renderToString } from "ziko-server"
function check(Component, attributes) {
if (typeof Component !== "function") return false;
return true
}
async function renderToStaticMarkup(Component, props, { default: children, ...slotted }, metadata) {
const UI = Component(props)
const html = renderToString(UI)
// console.log({metadata})
return {
html,
// hydration: {
// ...metadata,
// directive: "astro-zikojs",
// // componentExport: "default",
// // componentUrl: metadata.filePath,
// },
};
}
export default {
name : "astro-zikojs",
check,
renderToStaticMarkup
}