# gulp-lb-include

> Gulp plugin for `#include`-ing HTML files inside other HTML files, using `lb-include`

Latest version **0.3.1** (published 2015-04-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-lb-include
pnpm add gulp-lb-include
yarn add gulp-lb-include
bun add gulp-lb-include
```

## 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.3.1 |
| Published | 2015-04-03 |
| First published | 2014-11-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | Jeffrey Stanton |
| Maintainers | jffry |
| Keywords | gulpplugin, ssi, include, server-side include |

## Links

- npm: https://www.npmjs.com/package/gulp-lb-include
- Repository: https://github.com/jffry/gulp-lb-include
- Issues: https://github.com/jffry/gulp-lb-include/issues
- npm.io page: https://npm.io/package/gulp-lb-include

## Dependencies (4)

- [through2](https://npm.io/package/through2.md) ^0.6.3
- [gulp-util](https://npm.io/package/gulp-util.md) ^3.0.4
- [lb-include](https://npm.io/package/lb-include.md) ^0.3.1
- [lodash.merge](https://npm.io/package/lodash.merge.md) ^3.1.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.3.1 (latest) — 2015-04-03
- 0.3.0 — 2015-04-03
- 0.1.1 — 2014-11-07

## README

# gulp-lb-include

Library for using [`lb-include`](https://github.com/jffry/lb-include) as a [`gulp`](https://github.com/gulpjs/gulp) plugin

Builds hosted by [Travis CI](https://travis-ci.org/jffry/gulp-lb-include):
`master`: [<img src="https://api.travis-ci.org/jffry/gulp-lb-include.svg?branch=master" valign="middle" />](https://travis-ci.org/jffry/gulp-lb-include),
`develop`: [<img src="https://api.travis-ci.org/jffry/gulp-lb-include.svg?branch=develop" valign="middle" />](https://travis-ci.org/jffry/gulp-lb-include)


* [Install](#install)
* [Getting Started](#getting-started)
* [Configuration](#configuration)
* [Root Directory](#root-directory)
* [Tests](#tests)
* [License](#license)


## Install

```sh
$ npm install --save-dev gulp-lb-include
```

## Getting Started

It's easy to use!

```js
var gulp = require('gulp');
var lbInclude = require('gulp-lb-include');

gulp.task('include', function ()
{
    return gulp.src('app/**/*.html')
        .pipe(lbInclude())
        .pipe(gulp.dest('build/'));
});
```

You can also `npm install` and use [`gulp-plumber`](https://github.com/floatdrop/gulp-plumber) to tidily log
any errors that might get emitted, instead of having to trap and log them yourself:

```js
var gulp = require('gulp');
var plumber = require('gulp-plumber');
var lbInclude = require('gulp-lb-include');

gulp.task('include', function ()
{
    return gulp.src('app/**/*.html')
        .pipe(plumber())
        .pipe(lbInclude())
        .pipe(gulp.dest('build/'));
});
```

## Configuration

You can pass an optional configuration object, which will be passed through to `lb-include`.

```js
gulp.task('include-with-opts', function ()
{
    return gulp.src('app/**/*.html')
        .pipe(lbInclude({ varDefaults: {...} }))
        .pipe(gulp.dest('build/'));
});
```

You can pass any option supported by `lb-include` (see the [documentation for `lb-include`](https://github.com/jffry/lb-include)
for the entire list), aside from `fileContents`.  This plugin will set `fileContents` to the file contents provided by `gulp`.

## Root Directory

In the examples above, the [`base`](https://github.com/wearefractal/glob-stream#options) directory
from `gulp.src` will be used to resolve root-relative `#include`s like `<!-- #include file="/templates/nav.html" -->`

By default, the `base` directory in `gulp.src` is everything before the `glob` pattern (see the README for
[`glob2base`](https://github.com/wearefractal/glob2base) for details).

If you wish to use a different directory for resolving root-relative `#include`s, you can do so by passing
the `root` option to `lb-include` 

```js
gulp.task('include-custom-root', function ()
{
    return gulp.src('app/subdir/**/*.html')
        .pipe(lbInclude({ root: 'app/' }))
        .pipe(gulp.dest('build/'));
});
```

## Tests

To run the tests, checkout this repo and then `npm install && npm test`.
To rerun the tests automatically as you edit files, use `npm run test-watch` instead.


## License

Released under the MIT license © [Jeffrey Stanton](https://github.com/jffry)

See [LICENSE.md](LICENSE.md) for full license text

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