Gulp Copying Files from one Directory to another

不羁岁月 提交于 2019-12-05 10:27:40

问题


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?


回答1:


Try to add [], like this:

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


来源:https://stackoverflow.com/questions/24355907/gulp-copying-files-from-one-directory-to-another

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!