peter-vilja / gulp-clean

A gulp plugin for removing files and folders from given paths.
178 stars 21 forks source link

ENOENT on ** globs #17

Closed vpArth closed 8 years ago

vpArth commented 9 years ago

Hi guys.

Here is simple clean task:

gulp.task('clean', function () {
  return gulp.src('js/**', {read: false})
    .pipe(clean({force: true}));
});

My issue is hierarchy, for example

js/
js/modules/1.js

in this case, modules removes first, and when clean try to remove 1.js, ENOENT throwed.

Is there a way to handle ** globs in correct order(files, then dirs)? Or is there other glob to remove all in folder?

Thanks.

bonfish commented 9 years ago

@vpArth, I had the same problem solved by specifying an array of globs: first setting the one for files and then the universal one. Like this:

gulp.src(['js/**/*.js', 'js/**'], {read: false});

That way, the files seem to be selected prior to folders.

It looks like an issue of gulp itself or even glob-stream, not the plugin.

vpArth commented 9 years ago

Thanks, @bonfish. I solve it almost same way :) But I think it's not so hard to add some silent flag, which will just ignore absent files, while clean.

xlaywan commented 9 years ago

I solved it like this: gulp.src(['js/*'], {read: false})

rbarilani commented 9 years ago

The solution of @xlaywan doesn't work in my case.

vpArth commented 8 years ago

Repo is deprecated