htsl
Convert your JSON to HTML easily!
Getting Started
npm install htsl
Documentation
htsl exports just one function:
;
where document
is htsl-valid Javascript object, which is an HTML document.
htsl format
Each htsl document must be an object with document
property.
document
can contain head
property which will be HTML head
tag:
title
- page title (string)
meta
- meta of the page. Each property of this object will be converted to <meta key=value>
.
css
- array of strings, which are links (hrefs) to CSS stylesheets.
After the head there should be body
:
body
is the root htsl-element (node) of whole page.
Each htsl-element must follow this syntax:
where children
is element children (innerHTML). It can be:
- string
- object - then it should be another valid htsl-element
- array - array of valid htsl-elements
Example
You can run test/server.js script to start Express server, which will serve htsl-rendered page (test/page.json is the input).