# gulp-pug

> Gulp plugin for compiling Pug templates

Latest version **5.0.0** (published 2021-06-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-pug
pnpm add gulp-pug
yarn add gulp-pug
bun add gulp-pug
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2021-06-09 |
| First published | 2016-02-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10.13.0 |
| Dependencies | 6 |
| Unpacked size | 8.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 517 |
| Maintainers | phated, forbeslindesay, hemanth, demurgos |
| Keywords | jade, pug, gulpplugin, stream, compile |

## Links

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

## Dependencies (6)

- [pug](https://npm.io/package/pug.md) ^3.0.2
- [through2](https://npm.io/package/through2.md) ^4.0.2
- [fancy-log](https://npm.io/package/fancy-log.md) ^1.3.3
- [replace-ext](https://npm.io/package/replace-ext.md) ^2.0.0
- [plugin-error](https://npm.io/package/plugin-error.md) ^1.0.1
- [vinyl-contents](https://npm.io/package/vinyl-contents.md) ^1.0.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 5.0.0 (latest) — 2021-06-09
- 4.0.1 — 2018-04-08
- 4.0.0 — 2018-04-08
- 3.3.0 — 2017-03-08
- 3.2.0 — 2016-12-02
- 3.1.0 — 2016-10-04
- 3.0.4 — 2016-08-03
- 3.0.3 — 2016-06-01
- 3.0.2 — 2016-05-11
- 3.0.1 — 2016-05-10
- 3.0.0 — 2016-05-10
- 2.0.0 — 2016-04-21
- 1.3.1 — 2016-04-19
- 1.3.0 — 2016-04-17
- 1.2.0 — 2016-04-08
- … 16 more at https://npm.io/package/gulp-pug/versions

## README

<p align="center">
  <a href="http://gulpjs.com">
    <img height="257" width="257" src="https://raw.githubusercontent.com/gulpjs/artwork/master/community/logo-2021/community.png">
  </a>
</p>

# gulp-pug

[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]

Gulp plugin for compiling Pug templates. Enabling you to compile your Pug templates into HTML or JS, with support for template locals, custom Pug filters, AMD wrapping, and others.

## Usage

```js
const { src, dest } = require('gulp');
const pug = require('gulp-pug');

exports.views = () => {
  return src('./src/*.pug')
    .pipe(
      pug({
        // Your options in here.
      })
    )
    .pipe(dest('./dist'));
};
```

## API

### `pug([opts])`

- `opts` (`Object`): Any options from [Pug's API][api] in addition to `pug`'s own options.
- `opts.locals` (`Object`): Locals to compile the Pug with. You can also provide locals through the `data` field of the file object, e.g. with [`gulp-data`][gulp-data]. They will be merged with `opts.locals`.
- `opts.data` (`Object`): Same as `opts.locals`.
- `opts.client` (`Boolean`): Compile Pug to JavaScript code.
- `opts.pug`: A custom instance of Pug for `gulp-pug` to use.
- `opts.verbose`: display name of file from stream that is being compiled.

To change `opts.filename` use [`gulp-rename`][gulp-rename] before `gulp-pug`.

Returns a stream that compiles Vinyl files as Pug.

## Also See

- [`pug`][pug]
- [`gulp-data`][gulp-data]: Using locals in your Pug templates easier.
- [`gulp-rename`][gulp-rename]: Change `opts.filename` passed into Pug.
- [`gulp-wrap-amd`][gulp-wrap-amd]: Wrap your Pug in an AMD wrapper.
- [`gulp-frontmatter-wrangler`][gulp-frontmatter-wrangler]: Useful if you need YAML frontmatter at the top of your Pug file.

## License

MIT

<!-- prettier-ignore-start -->
[downloads-image]: https://img.shields.io/npm/dm/gulp-pug.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/gulp-pug
[npm-image]: https://img.shields.io/npm/v/gulp-pug.svg?style=flat-square

[ci-url]: https://github.com/gulp-community/gulp-pug/actions?query=workflow:dev
[ci-image]: https://img.shields.io/github/workflow/status/gulp-community/gulp-pug/dev?style=flat-square

[coveralls-url]: https://coveralls.io/r/gulp-community/gulp-pug
[coveralls-image]: https://img.shields.io/coveralls/gulp-community/gulp-pug/master.svg?style=flat-square
<!-- prettier-ignore-end -->

<!-- prettier-ignore-start -->
[pug]: https://github.com/pugjs/pug
[api]: https://pugjs.org/api/reference.html
[gulp-data]: https://npmjs.com/gulp-data
[gulp-rename]: https://npmjs.com/gulp-rename
[gulp-wrap-amd]: https://github.com/phated/gulp-wrap-amd
[gulp-frontmatter-wrangler]: https://github.com/DougBeney/gulp-frontmatter-wrangler
<!-- prettier-ignore-end -->

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