# @phtml/include

> Embed HTML partials into HTML

Latest version **4.2.0** (published 2019-05-17) · CC0-1.0 license · 0 weekly downloads

## Install

```sh
npm install @phtml/include
pnpm add @phtml/include
yarn add @phtml/include
bun add @phtml/include
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.2.0 |
| Published | 2019-05-17 |
| First published | 2019-02-11 |
| Weekly downloads | 0 |
| License | CC0-1.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8.0.0 |
| Dependencies | 1 |
| Unpacked size | 43.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Jonathan Neal |
| Maintainers | jonathantneal |
| Keywords | phtml, html, phtml-plugin, include, import, reference, embed |

## Links

- npm: https://www.npmjs.com/package/@phtml/include
- Repository: https://github.com/phtmlorg/phtml-include
- Homepage: https://github.com/phtmlorg/phtml-include#readme
- Issues: https://github.com/phtmlorg/phtml-include/issues
- npm.io page: https://npm.io/package/@phtml/include

## Dependencies (1)

- [phtml](https://npm.io/package/phtml.md) ^4.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

- 4.2.0 (latest) — 2019-05-17
- 4.1.0 — 2019-05-07
- 4.0.0 — 2019-05-06
- 3.0.0 — 2019-03-16
- 2.0.2 — 2019-03-11
- 2.0.1 — 2019-03-11
- 2.0.0 — 2019-02-19
- 1.0.1 — 2019-02-12
- 1.0.0 — 2019-02-11

## README

# pHTML Include [<img src="https://phtml.io/logo.svg" alt="pHTML" width="90" height="90" align="right">][phtml]

[![NPM Version][npm-img]][npm-url]
[![Build Status][cli-img]][cli-url]
[![Support Chat][git-img]][git-url]

[pHTML Include] lets you embed HTML partials into HTML.

```html
<!doctype html>
<html>
  <head>
    <title>phtml-include</title>
  </head>
  <body>
    <!-- where _body.html is <h1>Body Partial</h1> -->
    <include src="_body.html" />
  </body>
</html>

<!-- becomes -->

<!doctype html>
<html>
  <head>
    <title>phtml-include</title>
  </head>
  <body>
    <h1>Body Partial</h1>
  </body>
</html>
```

## Usage

Transform HTML files directly from the command line:

```bash
npx phtml source.html output.html -p @phtml/include
```

### Node

Add [pHTML Include] to your project:

```bash
npm install @phtml/include --save-dev
```

Use [pHTML Include] to process your HTML:

```js
const phtmlInclude = require('@phtml/include');

phtmlInclude.process(YOUR_HTML /*, processOptions, pluginOptions */);
```

Or use it as a [pHTML] plugin:

```js
const phtml = require('phtml');
const phtmlInclude = require('@phtml/include');

phtml([
  phtmlInclude(/* pluginOptions */)
]).process(YOUR_HTML /*, processOptions */);
```

[pHTML Include] runs in all Node environments, with special instructions for:

| [Node](INSTALL.md#node) | [CLI](INSTALL.md#phtml-cli) | [Eleventy](INSTALL.md#eleventy) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
| --- | --- | --- | --- | --- |

## Options

### cwd

The `cwd` option defines and overrides the current working directory of includes.

```js
// resolve all relative includes to /some/absolute/path
phtmlInclude({ cwd: '/some/absolute/path' });
```

[cli-img]: https://img.shields.io/travis/phtmlorg/phtml-include.svg
[cli-url]: https://travis-ci.org/phtmlorg/phtml-include
[git-img]: https://img.shields.io/badge/support-chat-blue.svg
[git-url]: https://gitter.im/phtmlorg/phtml
[npm-img]: https://img.shields.io/npm/v/@phtml/include.svg
[npm-url]: https://www.npmjs.com/package/@phtml/include

[pHTML]: https://github.com/phtmlorg/phtml
[pHTML Include]: https://github.com/phtmlorg/phtml-include

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