Gulp将文件从一个目录复制到另一个目录 [英] Gulp Copying Files from one Directory to another
问题描述
我想要复制多个文件
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),所有其他都被忽略。
我不想将每个文件都传送到目标目录。
我会如何去要做到这一点?
问候,
George
PS
我只是为了开发而使用它。在生产中,我会在部署它们之前连接并缩小它们。尽管如此,我相信任务很明确,我希望bower_components能够显示我的公共文件夹。我认为将bower_components文件夹中的所有文件都复制到公用目录中会有点繁琐。有没有其他的最佳做法来使用bower组件文件?
尝试添加[],如下所示:
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'));
这篇关于Gulp将文件从一个目录复制到另一个目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!