gulpjs / glob-stream

Readable streamx interface over anymatch.
MIT License
178 stars 53 forks source link

Exclude folder but include subdir does not work #25

Closed nstaeger closed 9 years ago

nstaeger commented 9 years ago

Hi,

lets pretend, I have the following folder structure:

system/
assets/
  |  one/
  |  two/
  |  three/
  |  ...
...

I would now like to stream over all files, but not the assets, but assets/two. In other words: I would like to have all files, except the asset files, that are in the subfolders one/, three/. I could do the following glob to do so:

[
  '**',
  '!assets/one/**',
  '!assets/three/**'
]

But if I would now add another folder within assets I would also need to add it as negative glob within my array. Much more intuitive would be the following glob:

[
  '**',
  '!assets/**',
  'assets/two/**'
]

But that one is not working. I cannot exclude a folder, and include a subfolder back in. But I think that would be very helpful. I am also using node-glob-all, which supports the second glob as expected. It seems like the structure of glob-stream does not support that kind of glob. Is that right? Or am I missing something out? Perhaps you would like to consider using node-glob-all in the future...

Best

PS: I am using gulp, which in the end uses your extension to load the files.

UltCombo commented 9 years ago

I believe this is because glob-stream always processes negative globs last, so:

[
  '**',
  '!assets/**',
  'assets/two/**'
]

Is equivalent to:

[
  '**',
  'assets/two/**',
  '!assets/**'
]

Same issue as https://github.com/gulpjs/gulp/issues/837