# html-fragments

> HTML fragments is simple static site generator which allows writing reusable HTML files.

Latest version **1.1.1** (published 2021-09-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install html-fragments
pnpm add html-fragments
yarn add html-fragments
bun add html-fragments
```

Provides the command `fragments`.

## 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.1.1 |
| Published | 2021-09-16 |
| First published | 2021-09-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Dusan Zahoransky |
| Maintainers | dusanz |
| Keywords | static, site, HTML, generator, include |

## Links

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

## 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.1.1 (latest) — 2021-09-16
- 1.1.0 — 2021-09-16
- 1.0.0 — 2021-09-09

## README

# HTML fragments

HTML fragments is simple static site generator which allows writing reusable HTML files, which can be included in other HTML files. The includes are recursively resolved.

Set recursive = true, to process the input directory recursively.  

## Usage

```processDir(inDir: string, outDir: string, recursive: boolean = false)```

### for example 
```
processDir("site/src", "site/out")
```

`site/src:`
```
├── index.html
├── partial
│   ├── navbar.html
```

index.html:
```
<header>
    <include src="partial/navbar.html" />
</header>
```

navbar.html:
```
 <nav>...</nav>
```

### results in

`site/out:`
```
├── index.html
```

index.html:
```
<header>
    <nav>...</nav>
</header>
```

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