# gulp-inject-html-template

> Inject html template into innerHTML

Latest version **0.2.2** (published 2017-01-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-inject-html-template
pnpm add gulp-inject-html-template
yarn add gulp-inject-html-template
bun add gulp-inject-html-template
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2017-01-08 |
| First published | 2016-12-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Glenn Vandeuren |
| Maintainers | basicelements |
| Keywords | gulpplugin |

## Links

- npm: https://www.npmjs.com/package/gulp-inject-html-template
- Repository: https://github.com/vandeurenglenn/gulp-inject-html-template
- Homepage: https://github.com/vandeurenglenn/gulp-inject-html-template#readme
- Issues: https://github.com/vandeurenglenn/gulp-inject-html-template/issues
- npm.io page: https://npm.io/package/gulp-inject-html-template

## Dependencies (3)

- [through2](https://npm.io/package/through2.md) ^2.0.1
- [gulp-util](https://npm.io/package/gulp-util.md) ^3.0.7
- [inject-template](https://npm.io/package/inject-template.md) ^0.2.2

## Recent versions

- 0.2.2 (latest) — 2017-01-08
- 0.2.1 — 2017-01-02
- 0.2.0 — 2017-01-02
- 0.1.1 — 2016-12-29
- 0.1.0 — 2016-12-29
- 0.0.0 — 2016-12-29

## README

# gulp-inject-html-template [![Build Status](https://travis-ci.org/vandeurenglenn/gulp-inject-html-template.svg?branch=master)](https://travis-ci.org/vandeurenglenn/gulp-inject-html-template)

> Inject html template into innerHTML


## Install

```
$ npm install --save-dev gulp-inject-html-template
```


## Usage

### File to inject template in
Add the **// @template** comment to your element, the comment will be replaced by the template's content
```js
class SomeElement extends HTMLElement {
	constructor() {
		super();
		// @template
	}
}
```

### Template to inject
```html
<template>
	<h1>hello world</h1>
</template>
```

### Usage in gulpfile
```js
const gulp = require('gulp');
const injectTemplate = require('gulp-inject-html-template');

// Inject html template into custom-element
// inject-template searches in the same directory for a matching template.html file
// in this case some-element.html
gulp.task('default', () => {
	gulp.src('src/some-element.js')
		.pipe(injectTemplate())
		.pipe(gulp.dest('dist'))
);
```

## TODO
- [ ] Add all inject-template options
- [ ] Support template id's (&lt;template id="some-element"&gt;)
- [ ] Add documentation for the new templatePath option

## License

MIT © [Glenn Vandeuren](https://github.com/vandeurenglenn)

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