gulp-pug

Gulp plugin for compiling Pug templates

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
gulp-pug
52245.0.03 years ago8 years agoMinified + gzip package size for gulp-pug in KB

Readme

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

gulp-pug
!NPM versionnpm-imagenpm-url !Downloadsdownloads-imagenpm-url !Build Statusci-imageci-url !Coveralls Statuscoveralls-imagecoveralls-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

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 APIapi 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-datagulp-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-renamegulp-rename before gulp-pug.
Returns a stream that compiles Vinyl files as Pug.

Also See

License

MIT