simple-html-index
A tiny through stream that returns a bare-bones HTML5 template with an optional
<link>
and <title>
in the head and <script>
entry-point in the body.
Example
In html.js
var html =
Now run node html.js > index.html
and you would end up with a file that looks like this: (after formatting)
hello
Usage
stream = html([opt])
Returns a read stream that writes a bare-bones HTML template, with the following optional features:
title
whether to include a<title>
elemententry
if specified, will add a<script src={{entry}}>
elementcss
if specified will add a<link rel="stylesheet" href={{css}}>
elementfavicon
iftrue
thefavicon.ico
request will be suppressedlang
the value of thelang
attribute in the root<html>
element, default'en'
base
if specified will add a<base href={{base}}>
element
Additional properties
Combine simple-html-index
with
hyperstream
to add additional
properties to html. An example how to add an extra <script>
tag to the body
tag:
const hyperstream = const html = const htmls = const hs = htmls
License
MIT, see LICENSE.md for details.