In my gulpfile.js
how do I correctly pass an array to gulp.src
and iterate through it's contents? Here's my existing code that needs correcting:
const paths = {
themes: [
{
name: 'cat',
js: ['src/cat/js/**', 'src/cat/assets/js/**']
},
{
name: 'dog',
js: ['src/dog/js/**', 'src/dog/assets/js/**']
}
],
dist: {
js: 'dist/js'
}
}
gulp.task( 'theme:assets',
function(done){
paths.themes.forEach(function(theme){
gulp.src(`${theme.js}`)
.pipe(newer(paths.dist.js + '/' + `${theme.name}`))
.pipe(gulp.dest(paths.dist.js + '/' + `${theme.name}`));
});
done();
}
);