在我的gulpfile.js
中,如何正确地将数组传递给gulp.src
并遍历其内容?这是我现有的代码,需要更正:
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();
}
);