I'm using gulp=4.0.2
, gulp-plumber=1.2.1
, gulp-pug=5.0.0
. My file structure is roughly
gulpfile.js
└── src/pug/pages
├── contact.pug
├── index.pug
└── projects
└── project.pug
My gulpfile.js
contains
import gulp from 'gulp';
const { src, dest, watch: __watch, parallel, series } = gulp;
import pug from 'gulp-pug';
import plumber from 'gulp-plumber';
function views() {
return (
src('src/pug/pages/**/*.pug')
.pipe(plumber())
.pipe(pug({
pretty: true
}))
.pipe(dest('./'))
.pipe(__reload())
)
}
const watch = parallel(watchTask, reload);
const build = series(parallel(styles, scripts, html, views));
const _build = build;
export { _build as build };
const _default = watch;
export { _default as default };
and when I run
gulp
it creates index.html
but it doesn't create projects/project.html
, what I would expect.
So basically what happened is that I must have run
gulp build
before and I forgot about it and then I created new pages when I hadsrc('src/pug/pages/*.pug')
and it worked but then I didn't know if it works for folders so I added**/
(src/pug/pages/**/*.pug
and got confused.gulp
alone runs a default task which doesn't runviews
function so it doesn't create HTML pages. In my casegulp build
creates them.The solution is to run