Modern Gulp plugin for Pug 3.x template compilation - Fast HTML generation from Pug templates with source maps, filters, and full Pug API support. Actively maintained.
Compiles your Pug templates into HTML or JavaScript easily and always uses the latest stable version of Pug.
- ✅ Supports the latest Pug version (3.x)
- ✅ Compiles to HTML or JS
- ✅ Custom locals and options
- ✅ Works with Gulp 4.x
- ✅ Modern Node.js support (18+)
npm install --save-dev gulp-pug-3const { src, dest } = require('gulp');
const pug = require('gulp-pug-3');
function compilePug() {
return src('src/**/*.pug')
.pipe(
pug({
// Your options here
})
)
.pipe(dest('dist'));
}
exports.default = compilePug;const { src, dest } = require('gulp');
const pug = require('gulp-pug-3');
function compilePug() {
return src('src/**/*.pug')
.pipe(
pug({
locals: {
siteName: 'My Website',
lang: 'en',
},
pretty: true,
basedir: __dirname + '/src',
})
)
.pipe(dest('dist'));
}
exports.default = compilePug;const { src, dest } = require('gulp');
const pug = require('gulp-pug-3');
function compilePugToJs() {
return src('src/**/*.pug')
.pipe(
pug({
client: true,
extension: '.js',
})
)
.pipe(dest('dist'));
}
exports.default = compilePugToJs;In addition to Pug's standard options, the following options are available:
Type: Boolean
Default: false
Compile to JavaScript template function instead of HTML.
Type: String
Default: .html (or .js if client: true)
Output file extension.
Type: Object
Default: {}
Data to pass to Pug templates. Can also be set via file.data (e.g., with gulp-data).
All standard Pug options are supported:
filenamebasedirdoctypeprettyfiltersselfdebugcompileDebugglobalscacheinlineRuntimeFunctionsname
See Pug documentation for details.
- Node.js >= 18.0.0
- Gulp >= 4.0.0
- 🚀 Updated config files to latest standards
- 🚀 Improved development workflow
- 🚀 Better code quality tools
- 🚀 Updated SEO-friendly package description
- Dependency updates
- 🚀 Updated to Pug 3.0.3
- 🚀 Modernized dependencies
- 🚀 Added GitHub Actions CI
- 🚀 Improved code quality with Prettier & ESLint
- 🚀 Node.js 18+ support
- Previous stable release
Contributions are welcome! Please feel free to submit a Pull Request.
When you encounter a problem, please open an issue. I would be glad to help you find a solution.
Orçun Saltık
- GitHub: @orcunsaltik
- Email: [email protected]
MIT © Orçun Saltık