从单个流生成多个文件。吞

时间:2016-11-01 20:28:04

标签: javascript stream gulp

我使用for,但这不对。

gulp.task('themes', function() {
    for (var color in config.themes) {
        for (var shine in config.shines) {
            gulp.src(['src/scss/_config.scss'])
                .pipe(rename('_' + config.themes[color] + '-' + config.shines[shine] + '.scss'))
                .pipe(gulp.dest('src/scss/themes'));
        }
    }
});

我怎么能用流?

1 个答案:

答案 0 :(得分:0)

只需使用多个管道gulp.dest()函数:

gulp.task('themes', function() {
   for (var color in config.themes) {
        for (var shine in config.shines) {
            gulp.src(['src/scss/_config.scss'])
                .pipe(rename('_' + config.themes[color] + '-' + config.shines[shine] + '.scss'))
                .pipe(gulp.dest('src/scss/themes'));
                .pipe(gulp.dest('src/scss/themes2'));
        }
    }
});'src/scss/themes'));