0.2.3 • Published 3 years ago

@prostory/edelweiss-ssr v0.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Edelweiss SSR

code style: prettier

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-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;
  1. The head property should contain an HTML that will be inserted between head element.
  2. The body property should contain an HTML that will be inserted between body element.
  3. The language property should contain a language tag that will be set as a value to lang attribute of the html tag. By default, it has en 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 ✌️

0.3.0-next.1

3 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago