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'));
});
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With