且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2022-10-23 07:39:38

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

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


I want to Gulp Copy Multiple Files

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'));
});

To copy my files from my bower_components directory to my assets directory, but it is only working with the first line (bootstrap.js), all others are ignored.

I wouldn't like to pipe every single file to the destination directory.

How would I go about to do this?

regards,

George

P.S. I am using it just for devel. In production I would concatenate and minify them before I deploy them. Nonetheless I believe that the task is clear, I want the bower_components to show up my public folder. I think that it is a little bit tedious to have all the files on the bower_components folder, only to copy them into your public directory. Is there any other best practice to use the bower component files?

Try to add [], like this:

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