Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use a glob to ignore files that start with an underscore?

Tags:

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'));
});
like image 740
Alan2 Avatar asked Dec 29 '14 12:12

Alan2


People also ask

How does glob work in Python?

glob (short for global) is used to return all file paths that match a specific pattern. We can use glob to search for a specific file pattern, or perhaps more usefully, search for files where the filename matches a certain pattern by using wildcard characters.

What are glob files?

A glob is a term used to define patterns for matching file and directory names based on wildcards. Globbing is the act of defining one or more glob patterns, and yielding files from either inclusive or exclusive matches.

What is glob Javascript?

A glob is a string of literal and/or wildcard characters used to match filepaths. Globbing is the act of locating files on a filesystem using one or more globs. The src() method expects a single glob string or an array of globs to determine which files your pipeline will operate on.


1 Answers

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.

like image 128
Barmar Avatar answered Oct 10 '22 20:10

Barmar