Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including gulp-pug with all npm packages installed. Try it out:

var gulpPug = require("gulp-pug")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

gulp-pug v4.0.1

Gulp plugin for compiling Pug templates

gulp-pug Build Status Dependencies Downloads

Gulp plugin for compiling Pug templates

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:

var pug = require('gulp-pug');

gulp.task('views', function buildHTML() {
  return gulp.src('views/*.pug')
    // Your options in here.



  • opts (Object): Any options from Pug's 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. They will be merged with opts.locals.
  • (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 before gulp-pug.

Returns a stream that compiles Vinyl files as Pug.

Also See



MIT © Jamen Marzonie


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free