Current Dev State

This commit is contained in:
Tim Lorsbach
2025-06-23 20:13:54 +02:00
parent b4f9bb277d
commit ded50edaa2
22617 changed files with 4345095 additions and 174 deletions

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Matt DesLauriers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,71 @@
# 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

View File

@ -0,0 +1,24 @@
const fromString = require('from2-string')
const favicon = '<link rel="shortcut icon"type="image/x-icon"' +
' href="data:image/x-icon;,">'
module.exports = createHtml
function createHtml (opt) {
opt = opt || {}
return fromString([
'<!DOCTYPE html>',
'<html lang="' + (opt.lang || 'en') + '" dir="' + (opt.dir || 'ltr') + '">',
'<head>',
opt.title ? ('<title>' + opt.title + '</title>') : '',
'<meta charset="utf-8">',
opt.base ? ('<base href="' + opt.base + '">') : '',
opt.css ? ('<link rel="stylesheet" href="' + opt.css + '">') : '',
opt.favicon ? favicon : '',
'</head><body>',
opt.entry ? ('<script src="' + opt.entry + '"></script>') : '',
'</body>',
'</html>'
].join(''))
}

View File

@ -0,0 +1,63 @@
{
"_from": "simple-html-index@^1.4.0",
"_id": "simple-html-index@1.5.0",
"_inBundle": false,
"_integrity": "sha1-LJPurrrAAdihNfwAIr1K3o9YmW8=",
"_location": "/simple-html-index",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "simple-html-index@^1.4.0",
"name": "simple-html-index",
"escapedName": "simple-html-index",
"rawSpec": "^1.4.0",
"saveSpec": null,
"fetchSpec": "^1.4.0"
},
"_requiredBy": [
"/budo"
],
"_resolved": "https://registry.npmjs.org/simple-html-index/-/simple-html-index-1.5.0.tgz",
"_shasum": "2c93eeaebac001d8a135fc0022bd4ade8f58996f",
"_spec": "simple-html-index@^1.4.0",
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/budo",
"author": {
"name": "Matt DesLauriers",
"email": "dave.des@gmail.com",
"url": "https://github.com/mattdesl"
},
"bugs": {
"url": "https://github.com/mattdesl/simple-html-index/issues"
},
"bundleDependencies": false,
"dependencies": {
"from2-string": "^1.1.0"
},
"deprecated": false,
"description": "a simple HTML index through stream",
"devDependencies": {
"concat-stream": "^1.5.0",
"tape": "^4.0.0"
},
"homepage": "https://github.com/mattdesl/simple-html-index",
"keywords": [
"through",
"stream",
"index",
"html",
"page",
"default"
],
"license": "MIT",
"main": "index.js",
"name": "simple-html-index",
"repository": {
"type": "git",
"url": "git://github.com/mattdesl/simple-html-index.git"
},
"scripts": {
"test": "node test.js"
},
"version": "1.5.0"
}