I'm trying to automate a concat task with gulp 4. The problem is that the task finishes before the files are written. So when the concat task runs, it doesn't have any files to concatenate.
function criticalCssConcat (done){
gulp.src('./user/themes/' + config.theme + '/assets/compiled/styles/critical/*.css')
.pipe(concat('./user/themes/' + config.theme + '/assets/compiled/styles/main.critical.css'))
.pipe(gulp.dest('.'));
done();
};
function criticalCss (done) {
Object.keys(config.criticalCSSPath).forEach(function (obj) {
critical.generate({
src: config.criticalCSSPath[obj],
width: 1920,
height: 1080,
dest: './user/themes/' + config.theme + '/assets/compiled/styles/critical/critical.' + obj + '.css'
})
})
done();
};