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

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

问题描述

我在 gulp 中使用这个文件匹配:

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?

代码如下:

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

推荐答案

如果 Gulp 通配符类似于 shell 通配符:

If Gulp wildcards are like shell wildcards:

content/css/[^_]*.css

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

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

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

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