Skip to content

Commit

Permalink
document caveat with the ** glob pattern
Browse files Browse the repository at this point in the history
closes #24
closes #3
  • Loading branch information
sindresorhus committed Jul 27, 2015
1 parent c5fefd6 commit 1fd6f0f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,23 @@ del(['tmp/*.js', '!tmp/unicorn.js'], function (err, paths) {
```


## Beware

The glob pattern `**` matches all children and *the parent*.

So this won't work:

```js
del.sync(['public/assets/**', '!public/assets/goat.png']);
```

You have to explicitly ignore the parent directories too:

```js
del.sync(['public/assets/**', '!public/assets', '!public/assets/goat.png']);
```


## API

### del(patterns, [options], callback)
Expand Down

2 comments on commit 1fd6f0f

@stramel
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sindresorhus Thank you for adding documentation on this! I think this will greatly help developers understand the caveat. 👍

@sindresorhus
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really would like to make it easier than this, but globbing is hard and lots of considerations to take into account. This will do for now.

Please sign in to comment.