全局匹配,排除所有JS文件 [英] Glob matching, exclude all JS files
本文介绍了全局匹配,排除所有JS文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是gulp.js的新用户。我想将所有非JavaScript文件移动到构建目录。
$ b
I'm a new user to gulp.js. I'd like to move all of my non-javascript files to a build directory. What I've got right now is this:
//Test copy
gulp.task('test-copy', function() {
gulp.src(['myProject/src/**/*.!(js|map|src)'])
.pipe(gulp.dest('myProject/build'));
});
//Results for various files
myProject/css/style.css //Copied - GOOD
myProject/html/index.html //Copied - GOOD
myProject/js/foo.js //Not Copied - GOOD
myProject/js/bar.min.js //Copied - BAD!
myProject/js/jquery-2.0.3.min.js //Copied - BAD!
myProject/js/jquery-2.0.3.min.map //Copied - BAD!
正如您所看到的,它只匹配文件路径字符串中的第一个点,而不是最后一个一个,如我所愿。如何修改glob搜索字符串的行为如我所愿?
As you can see, it only matches after the first dot in the file path string, not the last one, as I'd like. How can I modify the glob search string to behave as I'd like?
推荐答案
试试这个glob模式:
Try this glob pattern:
myProject/src/**/!(*.js|*.map|*.src)
这篇关于全局匹配,排除所有JS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文