# @mkfe/js2html

> 通过js配置来生成Document字符串

Latest version **1.0.1** (published 2021-01-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install @mkfe/js2html
pnpm add @mkfe/js2html
yarn add @mkfe/js2html
bun add @mkfe/js2html
```

## 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.0.1 |
| Published | 2021-01-12 |
| First published | 2021-01-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | monkeyfeiyu |
| Maintainers | monkeyfeiyu |
| Keywords | js2html, js, html |

## Links

- npm: https://www.npmjs.com/package/@mkfe/js2html
- Repository: https://github.com/monkeyfeiyu/mkfe
- Homepage: https://github.com/monkeyfeiyu/mkfe#readme
- Issues: https://github.com/monkeyfeiyu/mkfe/issues
- npm.io page: https://npm.io/package/@mkfe/js2html

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-01-12

## README

# Useage

```javascript
const getDocText = require('@mkfe/js2html');

const docText = getDocText({
    title: 'bala',
    meta: [
        {
            charset: 'utf-8'
        },
        {
            name: 'viewport',
            content: 'width=device-width, initial-scale=1'
        }
    ],
    link: {
        'shortcut icon': '/static/favicon.ico',
        'dns-prefetch': 'bala'
    },
    headScript: [
        {
            src: 'bala.js',
            crossorigin: 'anonymous'
        }
    ],
    style: [
        'static/a.css',
        {
            text: 'body {margin: 0;}'
        }
    ],
    bodyAttrs: {
        class: 'body-development'
    },
    bodyHtml: ['<div id="app"></div>'],
    script: [
        'https://code.jquery.com/jquery-3.3.1.min.js',
        {
            src: 'bala.js',
            crossorigin: 'anonymous'
        },
        {
            text: 'console.log("monkeyfeiyu")'
        }
    ]
});

console.log(docText);
```

# Return

```html
<!DOCTYPE html>
<html>
    <head>
        <title>bala</title>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <link rel="shortcut icon" href="/static/favicon.ico" />
        <link rel="dns-prefetch" href="bala" />
        <link rel="stylesheet" href="static/a.css" />
        <style>
            body {
                margin: 0;
            }
        </style>
        <script src="bala.js" crossorigin="anonymous"></script>
    </head>
    <body class="body-development">
        <div id="app"></div>
        <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
        <script src="bala.js" crossorigin="anonymous"></script>
        <script>
            console.log('monkeyfeiyu');
        </script>
    </body>
</html>
```

# Config

```javascript
// documentConfig

{
    title: 'bala',
    meta: [
        {
            charset: 'utf-8'
        },
        {
            name: 'viewport',
            content: 'width=device-width, initial-scale=1'
        }
    ],
    link: {
        'shortcut icon': '/static/favicon.ico',
        'dns-prefetch': 'bala'
    },
    headScript: [
        {
            src: 'bala.js',
            crossorigin: 'anonymous'
        }
    ],
    style: [
        'static/a.css',
        {
            text: 'body {margin: 0;}'
        }
    ],
    bodyAttrs: {
        class: 'body-development'
    },
    bodyHtml: [
        '<div id="app"></div>'
    ],
    script: [
        'https://code.jquery.com/jquery-3.3.1.min.js',
        {
            src: 'bala.js',
            crossorigin: 'anonymous'
        },
        {
            text: 'console.log("123")'
        }
    ]
}
```

### mark

-   npm publish --registry https://registry.npmjs.org

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