Use glob patterns in your Pug include directives.
$ npm install --save pug-include-globconst pugIncludeGlob = require('pug-include-glob');
const pug = require('pug');
let html = pug.renderFile('path/to/template.pug', {
plugins: [ pugIncludeGlob({ /* options */ }) ]
});res.render('view_name', { plugins: [ pugIncludeGlob({ /* options */ }) ] })gulp.src(src)
.pipe(pug({ plugins: [ pugIncludeGlob({ /* options */ }) ] }))
.pipe(gulp.dest(dest));glob- Options object passed tonode-globmethods. See node-glob for details.ignore- Files that should not be checked by this plugin. Checking every file is time expensive so excluding files where possible is likely to improve performance.
MIT © Jack Conway