# gulp-jade-modules

> Parses jade file includes and attempts to resolve them in the filesystem and node_modules

Latest version **1.0.1** (published 2015-12-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-jade-modules
pnpm add gulp-jade-modules
yarn add gulp-jade-modules
bun add gulp-jade-modules
```

## 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.0.1 |
| Published | 2015-12-15 |
| First published | 2015-12-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Tom Lagier |
| Maintainers | tomlagier |
| Keywords | jade, modules, gulp, node_modules |

## Links

- npm: https://www.npmjs.com/package/gulp-jade-modules
- Repository: https://github.com/tomlagier/gulp-jade-modules
- Homepage: https://github.com/tomlagier/gulp-jade-modules#readme
- Issues: https://github.com/tomlagier/gulp-jade-modules/issues
- npm.io page: https://npm.io/package/gulp-jade-modules

## Dependencies (4)

- [resolve](https://npm.io/package/resolve.md) ^1.1.6
- [through2](https://npm.io/package/through2.md) ^2.0.0
- [underscore](https://npm.io/package/underscore.md) ^1.8.3
- [vinyl-file](https://npm.io/package/vinyl-file.md) ^1.3.0

## Recent versions

- 1.0.1 (latest) — 2015-12-15
- 1.0.0 — 2015-12-15

## README

# gulp-jade-modules

[Gulp](http://gulpjs.com/) plugin to fully path [Jade](http://jade-lang.com/) includes and extends. Allows for easy includes of `node_modules` and arbitrary filesystem paths to encourage shared Jade partials between projects.

## Install

`npm install --save-dev gulp-jade-modules`

Recommended to use with [gulp-jade](https://www.npmjs.com/package/gulp-jade) and [gulp-filter](https://www.npmjs.com/package/gulp-filter)

## Usage

`gulpfile.js`
````
var gulp        = require('gulp'),
    jade        = require('gulp-jade'),
    jadeModules = require('gulp-jade-modules'),
    filter      = require('gulp-filter');

gulp.task('template-html', function() {
  return gulp.src('./templates/index.jade')
    .pipe(jadeModules({
      paths: ['../shared/templates/']
    }))
    .pipe(jade({
      basedir: '/'
    }))
    .pipe(filter(['*', '!_*']))
    .pipe(gulp.dest(conf.dist));
});
````

`index.jade`
````
include _header.jade
include @@_overlay.jade
include _footer.jade
````

The `gulp-jade-modules` plugin will attempt to resolve `_header.jade` and `_footer.jade` relative to the parent file, any additional paths, and the project. It will take the most specific path.

It will resolve any include matching `options.flag` to the `node_modules` directory, using [resolve](https://www.npmjs.com/package/resolve). Usage with [gulp-filter](https://www.npmjs.com/package/gulp-filter) is recommended to avoid writing a bunch of Jade partials out as unnecessary HTML snippets.

Note the `basedir: '/'` option passed to Jade - this is important because it fully resolves all paths in the stream, so Jade needs to know to use the root path to do its own file resolution.

## Options

### `paths`

Array of paths to attempt to resolve filesystem files in. Useful for shared local directories or git submodules.

Default: `[]`

### `flag`

Flag that occurs before path signaling `node_modules` lookup. With the default flag, `@@my-module/index.jade` would be resolved to the `node_modules` directory.

Default: `@@`

### `extension`

File extension to match dependencies to.

Default: `jade`

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