# simple-html-index

> a simple HTML index through stream

Latest version **1.5.0** (published 2016-08-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install simple-html-index
pnpm add simple-html-index
yarn add simple-html-index
bun add simple-html-index
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.0 |
| Published | 2016-08-25 |
| First published | 2015-06-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 33 |
| Author | Matt DesLauriers |
| Maintainers | mattdesl, yoshuawuyts |
| Keywords | through, stream, index, html, page, default |

## Links

- npm: https://www.npmjs.com/package/simple-html-index
- Repository: https://github.com/mattdesl/simple-html-index
- Issues: https://github.com/mattdesl/simple-html-index/issues
- npm.io page: https://npm.io/package/simple-html-index

## Dependencies (1)

- [from2-string](https://npm.io/package/from2-string.md) ^1.1.0

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.5.0 (latest) — 2016-08-25
- 1.4.0 — 2016-08-03
- 1.3.0 — 2016-06-16
- 1.2.1 — 2016-06-08
- 1.2.0 — 2016-03-07
- 1.1.2 — 2015-09-07
- 1.1.1 — 2015-09-07
- 1.1.0 — 2015-08-23
- 1.0.1 — 2015-06-19
- 1.0.0 — 2015-06-19

## README

# simple-html-index

[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)

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`

```js
var html = require('simple-html-index')

html({ title: 'hello', entry: 'bundle.js' })
  .pipe(process.stdout)
```

Now run `node html.js > index.html` and you would end up with a file that looks like this: (after formatting)

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <title>hello</title>
  <meta charset="utf-8">
</head>
<body>
  <script src="bundle.js"></script>
</body>
</html>
```

## Usage

[![NPM](https://nodei.co/npm/simple-html-index.png)](https://www.npmjs.com/package/simple-html-index)

#### `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>` element
- `entry` if specified, will add a `<script src={{entry}}>` element
- `css` if specified will add a `<link rel="stylesheet" href={{css}}>` element
- `favicon` if `true` the `favicon.ico` request [will be suppressed][1]
- `lang` the value of the `lang` 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`](https://github.com/substack/hyperstream) to add additional
properties to html. An example how to add an extra `<script>` tag to the body
tag:
```js
const hyperstream = require('hyperstream')
const html = require('simple-html-index')

const htmls = html({ entry: 'static/bundle.js' })
const hs = hyperstream({
  body: { _appendHtml: "<script>console.log('extra tags!')</script>" }
})

htmls.pipe(hs).pipe(process.stdout)
```

## License

MIT, see [LICENSE.md](http://github.com/mattdesl/simple-html-index/blob/master/LICENSE.md) for details.

[1]: http://stackoverflow.com/a/5568484/1541707

---
_Source: https://npm.io/package/simple-html-index · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
