Gulp将文件从一个目录复制到另一个目录

时间:2014-06-22 21:28:06

标签: gulp bower

我想 Gulp复制多个文件

gulp.task('copy', function(){

     gulp.src(
        'bower_components/bootstrap/dist/js/bootstrap.js', 
        'bower_components/jquery/dist/jquery.min.js', 
        'bower_components/jquery.stellar/src/jquery.stellar.js',
        'bower_components/jquery-waypoints/waypoints.js',
        'bower_components/jquery-easing-original/jquery.easing.1.3.js')
    .pipe(gulp.dest('public/assets/js'));
});

要将我的文件从bower_components目录复制到我的资产目录,但它只与第一行(bootstrap.js)一起使用,其他所有文件都被忽略。

我不想将每个文件都传送到目标目录。

我将如何做到这一点?

问候,

乔治

P.S。 我只是为了开发而使用它。在生产中,我会在部署之前连接并缩小它们。尽管如此,我相信任务很明确,我希望bower_components显示我的公共文件夹。我认为将所有文件放在bower_components文件夹中只是将它们复制到公共目录中有点乏味。是否还有其他最佳做法来使用bower组件文件?

1 个答案:

答案 0 :(得分:39)

尝试添加[],如下所示:

gulp.src([
    'file1',
    'file2',
    'file3'
])
.pipe(gulp.dest('public/assets/js'));