0.2.3 • Published 3 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 require
d. If you organize your code as CommonJS
modules, then you should transpile this package as well.
Installation
npm i @prostory/edelweiss-ssr
Usage
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
head
property should contain an HTML that will be inserted betweenhead
element. - The
body
property should contain an HTML that will be inserted betweenbody
element. - The
language
property should contain a language tag that will be set as a value tolang
attribute of thehtml
tag. By default, it hasen
value.
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 ✌️