Answer the question
In order to leave comments, you need to log in
How to make a task in gulp to process pug modules?
There are pug pages of the site and a folder with modules that are embedded in pages using include.
If I change something in a module, gulp doesn't see it and I have to compile the pug files and html files to the root each time. What can be done?
Here is my gulpfile
var pug = require("gulp-pug");
gulp.task('pug', function() {
return gulp.src('pug/**/*.pug')
.pipe(pug({
pretty: true
}))
.pipe(gulp.dest(''))
.pipe(
browserSync.reload({stream: true})
);
});
Answer the question
In order to leave comments, you need to log in
var reload = browserSync.reload;
var runSequence = require('run-sequence');
gulp.task('pug', function () {
return gulp.src('source/*.pug')
.pipe(pug({pretty: true}))
.pipe(gulp.dest(''))
});
gulp.task('watch', function(){
$.watch('source/**/*.pug ', function(event, cb) {
return runSequence('pug', reload);
});
}
So... google gulp-watch and screw it up. Now your task fulfills 1 time.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question