gulpjs / glob-stream

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

Negative glob not working in some cases #20

Closed holic closed 10 years ago

holic commented 10 years ago

I have a directory structure that looks a bit like this:

assets/
  css/
    theme.css
  js/
    app.js
  images/
    logo.png
    content/
      2014-06-29-livestock.jpg
      2014-06-30-building.jpg

All but assets/images/content/* are generated by Gulp. The contents of assets/images/content/ are copied from another location via bash script. I'd like to clean the Gulp-generated files, but leave the files in assets/images/content/.

I've tried the following globs to no avail:

And eventually found that specifying all the paths explicitly works:

[
  "assets/css",
  "assets/js",
  "assets/images/*",
  "!assets/images/content"
]
yocontra commented 10 years ago

Can I see your gulp task that's using these globs?

holic commented 10 years ago

Sure!

gulp.task "clean", ->
    gulp.src ["jekyll/assets", "!jekyll/assets/images/content"], read: no
        .pipe clean()

Replace that glob array with any of the arrays above.

yocontra commented 10 years ago

Why don't you do that in each task and only for the folders the task touches?

holic commented 10 years ago

Can you provide an example of how that might work for concat'ing JS files and compiling CSS?

To me, it doesn't really make sense to clean up within each task when the target files will be overwritten by the end of the task anyway.

yocontra commented 10 years ago

Have you tried using the del module for deleting files and folders? I don't recommend using gulp-clean