我如何使用glob来忽略以下划线开头的文件? [英] How can I use a glob to ignore files that start with an underscore?

查看:156
本文介绍了我如何使用glob来忽略以下划线开头的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 'content / css / *。css'

但我只想包含以下划线开头的文件。有人能告诉我如何做到这一点吗?



以下是代码:

  gulp.task('less',function(){
gulp.src('content / less / *。less')
.pipe(less())
.pipe (gulp.dest('content / css'));
});


解决方案

如果gulp通配符与shell通配符类似:

  content / css / [^ _] *。css 

字符集开头的 ^ 表示匹配集合中的任何字符 not

I am using this file matching in gulp:

'content/css/*.css'

But I would like to only include the files that do not start with an underscore. Can someone tell me how I can do this?

Here's the code:

gulp.task('less', function () {
    gulp.src('content/less/*.less')
        .pipe(less())
        .pipe(gulp.dest('content/css'));
});

解决方案

If Gulp wildcards are like shell wildcards:

content/css/[^_]*.css

The ^ at the beginning of a character set means to match any characters not in the set.

这篇关于我如何使用glob来忽略以下划线开头的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆