Socket
Socket
Sign inDemoInstall

gulp-pug

Package Overview
Dependencies
Maintainers
4
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-pug - npm Package Compare versions

Comparing version 4.0.1 to 5.0.0

26

CHANGELOG.md

@@ -1,14 +0,18 @@

# v4.0.1 (2018-04-08)
# Changelog
- **Patch**: Fix Typescript type definitions. (#179)
- **Internal**: Drop dependency on `object-assign`. (#177)
- **Internal**: Use `eslint` directly (without `gulp`). (#180)
## [5.0.0](https://www.github.com/gulp-community/gulp-pug/compare/v4.0.1...v5.0.0) (2021-06-09)
# v4.0.0 (2018-04-08)
### ⚠ BREAKING CHANGES
- **Breaking change**: Update required Node version from `0.10` to `4.0.0`. (#171)
- **Feature**: Add Typescript type definitions. (#173)
- **Patch**: Drop dependency on deprecated `gulp-util`. (#172)
- **Internal**: Move repo to `gulp-community/gulp-pug`. (#175)
- **Internal**: Update dependencies. (#175)
- **Internal**: Add `CHANGELOG.md`
- Update dependencies (#221)
- Convert to gulp scaffold, dropping node <10 support (#215)
### Features
- Add streaming support using vinyl-contents ([#200](https://www.github.com/gulp-community/gulp-pug/issues/200)) ([642d1ea](https://www.github.com/gulp-community/gulp-pug/commit/642d1ea8088dd14162a6ccb767ebf8fbda690456))
- Add template filename to PluginError ([#220](https://www.github.com/gulp-community/gulp-pug/issues/220)) ([cfaad8c](https://www.github.com/gulp-community/gulp-pug/commit/cfaad8c5d6923d6c15f824ae717c5f0d16fc7490))
### Miscellaneous Chores
- Convert to gulp scaffold, dropping node <10 support ([#215](https://www.github.com/gulp-community/gulp-pug/issues/215)) ([004417e](https://www.github.com/gulp-community/gulp-pug/commit/004417e79c5e3013ad1c3a913e8e4b3ad23b8813))
- Update dependencies ([#221](https://www.github.com/gulp-community/gulp-pug/issues/221)) ([8bb7f1c](https://www.github.com/gulp-community/gulp-pug/commit/8bb7f1c24bd05b33bda01efd8ed37a10d3417c97))

@@ -1,3 +0,3 @@

import { Transform } from "stream";
import { Options as PugOptions } from "pug";
import { Transform } from 'stream';
import { Options as PugOptions } from 'pug';

@@ -4,0 +4,0 @@ /**

@@ -8,2 +8,3 @@ 'use strict';

const log = require('fancy-log');
const vinylContents = require('vinyl-contents');

@@ -22,10 +23,16 @@ module.exports = function gulpPug(options) {

if (file.isStream()) {
return cb(new PluginError('gulp-pug', 'Streaming not supported'));
}
vinylContents(file, function onContents(err, contents) {
if (err) {
return cb(
new PluginError('gulp-pug', err, { fileName: opts.filename })
);
}
if (file.isBuffer()) {
if (!contents) {
return cb(null, file);
}
try {
let compiled;
const contents = String(file.contents);
if (opts.verbose === true) {

@@ -39,9 +46,12 @@ log('compiling file', file.path);

}
file.contents = new Buffer(compiled);
} catch (e) {
return cb(new PluginError('gulp-pug', e));
file.contents = Buffer.from(compiled);
} catch (err) {
return cb(
new PluginError('gulp-pug', err, { fileName: opts.filename })
);
}
}
cb(null, file);
cb(null, file);
});
});
};
{
"name": "gulp-pug",
"version": "4.0.1",
"version": "5.0.0",
"description": "Gulp plugin for compiling Pug templates",
"nyc": {
"reporter": [
"lcov",
"text-summary"
]
},
"prettier": {
"singleQuote": true
},
"keywords": [

@@ -20,25 +29,29 @@ "jade",

"engines": {
"node": ">= 4.0.0"
"node": ">=10.13.0"
},
"scripts": {
"test": "npm run lint && tap ./test",
"lint": "eslint index.js \"test/**/*.js\""
"pretest": "npm run lint",
"test": "nyc mocha --async-only",
"lint": "eslint ."
},
"license": "MIT",
"dependencies": {
"@types/pug": "^2.0.4",
"fancy-log": "^1.3.2",
"fancy-log": "^1.3.3",
"plugin-error": "^1.0.1",
"pug": "^2.0.3",
"replace-ext": "^1.0.0",
"through2": "^2.0.3"
"pug": "^3.0.2",
"replace-ext": "^2.0.0",
"through2": "^4.0.2",
"vinyl-contents": "^1.0.0"
},
"devDependencies": {
"@types/node": "^9.6.2",
"eslint": "^4.19.1",
"eslint-config-google": "^0.9.1",
"gulp": "^4.0.0",
"tap": "^11.1.3",
"vinyl": "^2.1.0"
"@types/node": "^14.0.0",
"@types/pug": "^2.0.4",
"eslint": "^7.0.0",
"eslint-config-gulp": "^5.0.0",
"expect": "^27.0.2",
"mississippi": "^4.0.0",
"mocha": "^8.0.0",
"nyc": "^15.0.1",
"vinyl": "^2.2.0"
}
}

@@ -1,15 +0,28 @@

# gulp-pug [![Build Status][status-img]][status] ![Dependencies][deps] ![Downloads][downloads]
> Gulp plugin for compiling Pug templates
<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>
This Gulp plugin enables you to compile your Pug templates into HTML or JS, with support for template locals, custom Pug filters, AMD wrapping, and others. Here is a simple example using `gulp-pug`:
# gulp-pug
```javascript
var pug = require('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.task('views', function buildHTML() {
return gulp.src('views/*.pug')
.pipe(pug({
// Your options in here.
}))
});
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'));
};
```

@@ -21,9 +34,9 @@

- `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.
- `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`.

@@ -35,20 +48,26 @@

- [`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.
- [`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.
## Thanks
## License
- Many thanks to [Blaine Bublitz][phated] for the original `gulp-jade` plugin.
MIT
## LICENSE
<!-- 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
[MIT][license] &copy; Jamen Marzonie
[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
[status]: https://travis-ci.org/gulp-community/gulp-pug
[status-img]: https://travis-ci.org/gulp-community/gulp-pug.png?branch=master
[deps]: https://david-dm.org/gulp-community/gulp-pug.svg
[downloads]: https://img.shields.io/npm/dm/gulp-pug.svg
[pug]: http://github.com/gulp-community/pug
[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

@@ -58,3 +77,3 @@ [gulp-data]: https://npmjs.com/gulp-data

[gulp-wrap-amd]: https://github.com/phated/gulp-wrap-amd
[phated]: https://github.com/phated
[license]: LICENSE
[gulp-frontmatter-wrangler]: https://github.com/DougBeney/gulp-frontmatter-wrangler
<!-- prettier-ignore-end -->

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc