Questions tagged [node-glob]

18 questions
24
votes
1 answer

How to include multiple file extensions with 'glob.sync' in NodeJS?

Can anyone please suggest how to add multiple file extensions with the glob.sync method. Something like: const glob = require('glob'); let files = glob.sync(path + '**/*.(html|xhtml)'); Thank you :)
asishkhuntia
  • 417
  • 1
  • 4
  • 7
11
votes
4 answers

How to make Gulp.src fail if a file is missing?

Our gulp build takes a bunch of libraries installed with bower, then concatenates them with all the code we have distributed across several directories. Here's what it looks like: var jsFiles = [ sourcePath + '/config/config.js', …
Kaivosukeltaja
  • 15,541
  • 4
  • 40
  • 70
5
votes
2 answers

node glob pattern include all js except in certain folders

I have a project that looks like this ls foo/ - file0.js - a/file1.js - b/file2.js - c/file3.js - d/file4.js How do I write a glob pattern to exclude the c & d folder but get all other javascript files? I have looked here for an example, but cannot…
random-forest-cat
  • 33,652
  • 11
  • 120
  • 99
4
votes
3 answers

gulp.src() include files but ignore all folders

There is certainly such a simple answer to this that I can't find anyone that's asked it before: What globbing pattern to include all the files in a folder but ignore ALL subfolders? gulp.src('*') includes all files and folders. I just want the…
sthames42
  • 888
  • 8
  • 19
3
votes
1 answer

Joining loop of arrays in Node.js glob results

I have this script: var glob = require('glob'); glob('*.jpg', { cwd: 'public/portfolio/weddings/', sort: true }, function (err, files) { var globResults = files; globResults.forEach(function(entry) { var results = '\'' + entry + '\''; …
Lanti
  • 2,299
  • 2
  • 36
  • 69
3
votes
2 answers

Gulp: how do I see filenames of my glob

in Gulp, I have a glob pattern that I want to verify. For instance: gulp.task('clean-requirejs', function() { return gulp.src([ './public/res-min/**/*.js' ]) .pipe(clean()); }); I want to see how the glob…
Jesper Rønn-Jensen
  • 106,591
  • 44
  • 118
  • 155
2
votes
1 answer

node-glob match all files but a single file

I'm trying to write a glob pattern that matches all files *.* but not index.html. I started with: *.*!(index.html), but this doesn't result in the correct output. I'm reading node-glob documentation. After looking at this answer I feel it may not be…
Callum Linington
  • 14,213
  • 12
  • 75
  • 154
1
vote
1 answer

Glob matching file or directory

I'm using node-glob, https://github.com/isaacs/node-glob. My structure is: img/ -/nested image1.png image2.jpg -/emtpy image1.png image2.jpg I'm trying to get all the images + empty directories Using '**/*+(.jpg|.png)' Results in:…
Denis Rybalka
  • 1,821
  • 3
  • 18
  • 28
1
vote
2 answers

Glob pattern include all js exclude certain endings

I'd like to use glob with mocha. Sadly mocha does not support exclude and it does not pass glob options either, so I have to solve this in a single pattern without the usage of the glob ignore option. https://github.com/mochajs/mocha/issues/1577 The…
inf3rno
  • 24,976
  • 11
  • 115
  • 197
1
vote
1 answer

debugging gulp glob patterns (node-glob)

I have a gulp task like this: const dest_free = "build/free"; gulp.task("build-free", ["clean-free"], function () { gulp.src(["src/**", "!src/composer.*", "LICENSE", "src/plugins/index.php", "!src/plugins/**"]) …
Gezim
  • 7,112
  • 10
  • 62
  • 98
1
vote
1 answer

Globbing for double extension files

I have this Gulp snippet: gulp.src(['./assets/**/*.!(coffee|scss)', '!assets/images{,/**}']) .pipe(gulp.dest('.tmp/public')) And this folder structure: assets js A.coffee A.B.coffee A.B.C.coffee X.js The intention is to copy everything…
amyspark
  • 520
  • 1
  • 4
  • 15
1
vote
0 answers

nodejs del: use absolute path

I'd like to absolute paths with sindresorhus' node del plugin (or really node-glob) but it doesn't seem to work. I tried fiddling around with node-glob's options like cwd and root, but didn't get it to work. Any idea anyone? One of my attempts: var…
publicJorn
  • 2,404
  • 1
  • 20
  • 30
1
vote
1 answer

Node.js glob include/exclude files

this is my current code to copy relevant files from my source to my build dir. It does not work as expected return gulp.src([ 'src/**/*', '!src/**/*(*.sass|*.scss|*.js)', '!src/(components|config|elements|less|sass|scss|platforms)', …
Merion
  • 721
  • 2
  • 13
  • 24
0
votes
0 answers

angular node glob options to copy assets files

I have this folder structure which is created using nx dynamic module federation (minimum fileset for better visualization) . └─ apps ├─ app-1 │ └─ src │ └─ assets │ └─ test.json ├─ app-2 │ └─…
Bhanu Chhabra
  • 474
  • 1
  • 6
  • 22
0
votes
1 answer

Conditionally Ignore files in gulp.src

The source code is used for 2 projects, Each project has some common code. I want to conditionally ignore a module/folder/directory via gulp task. When I do following it works perfectly return gulp.src( config.appMarkupFiles '!app/settings',…
1
2