# gulp-html-header-footer

> Injection plugin for gulp. It simply injects header and footer from source streams.

Latest version **2.0.0** (published 2021-06-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install gulp-html-header-footer
pnpm add gulp-html-header-footer
yarn add gulp-html-header-footer
bun add gulp-html-header-footer
```

## 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 | 2.0.0 |
| Published | 2021-06-20 |
| First published | 2018-02-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jeewhan Kim |
| Maintainers | jeewhankim |
| Keywords | gulp, gulp-html-header-footer |

## Links

- npm: https://www.npmjs.com/package/gulp-html-header-footer
- npm.io page: https://npm.io/package/gulp-html-header-footer

## Dependencies (2)

- [gulp-util](https://npm.io/package/gulp-util.md) ^3.0.0
- [event-stream](https://npm.io/package/event-stream.md) ^3.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

- 2.0.0 (latest) — 2021-06-20
- 1.0.0 — 2018-03-11
- 0.8.0 — 2018-02-23
- 0.5.0 — 2018-02-21

## README

## Installation

Install `gulp-html-header-footer` as a development dependency:

```shell
npm install --save-dev gulp-header-footer
```

** This package is a simplified version of [gulp-inject](https://www.npmjs.com/package/gulp-inject). The difference is that it does not need to update any HTML codes itself. All license behind the logic belong to [MIT](https://spdx.org/licenses/MIT.html) & [the collaborator of `gulp-inject`](https://www.npmjs.com/~joakimbeng) **

## Basic usage

**The target file `src/index.html`:**

`gulp-html-header-footer` simply injects strings of header & footer from gulp source streams.

Expected Result:

```html
<!DOCTYPE html>
<html>
<head>
  <title>index.html</title>
</head>
<body>
<!-- Header -->
<!-- Contents -->
<section>
  <div>Lorem Ipsum</div>
</section>
<!-- Contents:End -->
<!-- Footer -->
</body>
</html>
```

**`gulpfile.js`:**

```javascript

gulp.task('html-header-footer', () => {
  const headerFooter = require('gulp-html-header-footer')
  gulp.src(['./html/**/*.html'])
  .pipe(headerFooter(gulp.src(['./html/**/*.html']), 
    {
      header:'<!DOCTYPE html><html><head><title>index.html</title></head><body>', 
      footer:'</body></html>'
    }))
  .pipe(gulp.dest('./dist/'))
})

```

**`More examples - using external arguments (modules):`**

```javascript
/* _template.js */
module.exports = {
  header: require('./_header.js')(),
  footer: require('./_footer.js')()
}

/* _header.js */
module.exports = () => {
  return `
    <!DOCTYPE html><html><head><title>index.html</title></head><body>
  `
}
/* _footer.js */
module.exports = () => {
  return `
      </body>
      </html>
  `
}

```

```javascript

gulp.task('html-header-footer', () => {
  const headerFooter = require('gulp-html-header-footer')
  const template = require('./_template.js')

  gulp.src(['./html/**/*.html'])
  .pipe(headerFooter(gulp.src(['./html/**/*.html']), template))
  .pipe(gulp.dest('./dist/'))
})

```

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