0.2.3 • Published 4 years ago
@prostory/edelweiss-ssr v0.2.3
Edelweiss SSR
A set of utilities for Edelweiss SSR.
Intention
It is a place where useful helpers will live.
Get started
This package is bundled as ES modules, so it can not be required. If you organize your code as CommonJS modules, then you should transpile this package as well.
Installation
npm i @prostory/edelweiss-ssrUsage
There is only one function layout, for now. It creates an HTML page.
interface LayoutOptions {
readonly head?: string;
readonly body?: string;
readonly language?: string;
}
function layout(options: LayoutOptions): string;- The
headproperty should contain an HTML that will be inserted betweenheadelement. - The
bodyproperty should contain an HTML that will be inserted betweenbodyelement. - The
languageproperty should contain a language tag that will be set as a value tolangattribute of thehtmltag. By default, it hasenvalue.
const page = layout({
head: '<title>A page title</title>',
body: '<div>Hello world.</div>',
language: 'en',
});or you can use html function of @prostory/edelweiss package:
import { layout } from '@prostory/edelweiss-ssr';
import { html, language } from '@prostory/edelweiss';
const page = layout({
head: render(html`<title>A page title</title>`),
body: render(html`<div>Hello world.</div>`),
language: language(),
});Word from author
Have fun ✌️