Gulp 将文件从一个目录复制到另一个目录 [英] Gulp Copying Files from one Directory to another
问题描述
我想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 目录复制到我的 assets 目录,但它仅适用于第一行 (bootstrap.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.
我该怎么做呢?
问候,
乔治
附:我只是将它用于开发.在生产中,我会在部署它们之前连接并缩小它们.尽管如此,我相信任务很明确,我希望 bower_components 显示我的公共文件夹.我认为将所有文件都放在 bower_components 文件夹中有点乏味,只是将它们复制到您的公共目录中.使用 bower 组件文件还有其他最佳做法吗?
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屋!