KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a situation where I'm trying to use grunt to lint a codebase, excluding specific folders. grunt uses minimatch (similar to bsdglob) under the hood to match files, but I can't seem to figure out how to do a .gitignore style exclude of a folder. I'd like to ingest this: ignoreme and match these: /folder/path/here/to/something/ok.js /another/folder/path.js /test.js but not match these: /folder/ignoreme/something.js /folder/path/here/to/ignoreme/metoo/file.js This will match everything, including ignoreme: /**/*.js So I figured I could do something like: /**/!(ignoreme)/**/*.js but that matches files in the ignoreme folder. I'm used to regexes, but can't seem to figure out how to repeat a pattern or something here - I also tried stuff like: /(!(ignoreme)|*)*/*.js hoping the container would repeat, but that doesn't work, it just fails to match everything. Any way to either pass a regex to grunt file paths, or make this work for me? Update: Here's how I'm currently dealing with this issue: var pattern = /\/ignoreme\// var files = grunt.file.expandFiles(arrayOfFilesPassedToMinimatch).filter(function(f){ return !pattern.test(f) }) I'd still be interested if folder excludes are possible in minimatch.
Tags (comma-separated)
Save Edits
Cancel