blob: e8ece01bac499606b0b80289e82e0497fb200769 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import { h } from 'preact';
import { renderToString } from 'preact-render-to-string';
import StaticHtml from './static-html.js';
function check(Component, props) {
try {
return Boolean(renderToString(h(Component, props)));
} catch (e) {}
return false;
}
function renderToStaticMarkup(Component, props, children) {
const html = renderToString(h(Component, props, h(StaticHtml, { value: children })));
return { html };
}
export default {
check,
renderToStaticMarkup,
};
|