Есть две Gulp задачи. Когда я пытаюсь ввести предвыполнение pug:data перед pug, выполняется только pug:data. Где ошибся, как исправить? Без gulp.series pug полностью рабочая задача.
gulp.task('pug:data', function() {
return gulp.src('src/data/**/*.json')
.pipe(merge({
fileName: 'data.json',
edit: (json, file) => {
var filename = nodePath.basename(file.path),
primaryKey = filename.replace(nodePath.extname(filename), ''),
data = {};
data[primaryKey] = json;
return data;
}
}))
.pipe(gulp.dest('temp'));
});
gulp.task('pug', gulp.series('pug:data'), function buildHTML() {
return gulp.src(path.src.pug)
.pipe(pug({
pretty: true,
data: JSON.parse(fs.readFileSync('temp/data.json'))
}))
.pipe(gulp.dest(path.build.html))
.pipe(browserSync.stream())
});
gulp_sequence
. Мой ответ на похожий вопрос.