# lit-html-template

> Example:

Latest version **1.0.4** (published 2024-08-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install lit-html-template
pnpm add lit-html-template
yarn add lit-html-template
bun add lit-html-template
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2024-08-26 |
| First published | 2022-06-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | saminn.liu |

## Links

- npm: https://www.npmjs.com/package/lit-html-template
- npm.io page: https://npm.io/package/lit-html-template

## Recent versions

- 1.0.4 (latest) — 2024-08-26
- 1.0.3 — 2024-08-26
- 1.0.2 — 2024-08-26
- 1.0.1 — 2022-06-20
- 1.0.0 — 2022-06-20

## README

Example:

post.html.js
```javascript
const html = require('lit-html-template');
const post = function (data) {
    return html`
    <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>${data.title}</title>
        </head>

        <body>
            <h2>
                <a href="/">首页</a>
            </h2>
            <div>
                ${data.content}
            </div>
        </body>
    </html>
    `;
}

module.exports = post;

```

post.controller.js
```javascript

app.get('/:slug/', async (request, reply) => {
        const res = await db.get(`SELECT * FROM posts WHERE slug=? LIMIT 1`, [request.params.slug]);
        reply
            .code(200)
            .header('Content-Type', 'text/html; charset=utf-8')
            .send(view.post(res))
    })

```

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