question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Negating a pattern is not working

See original GitHub issue
.
├── assets
│   ├── .gitkeep
│   ├── rev-manifest.json
│   ├── style-2ccbb519.css

I’m auto compiling my less and using gulp-rev for revisioning. I have a clean:css task defined like so:

gulp.task('clean:css', function (cb) {
    del(['public/assets/**', '!public/assets/.gitkeep'], cb);
});

When running the clean:css task everything in the public/assets directory is removed including .gitkeep, I expect .gitkeep to remain in place. I have replaced .gitkeep with example.txt to rule out problems with empty files and the problem persists (example.txt contained “example”).

Have I missed something obvious, if not is there something I can do to debug this? I’m using ubuntu 14.04 (through Vagrant). Gulp is at version 3.8.7, npm is 1.3.10 and del is 0.1.1.

I followed this recipe.

Thank you!

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:27 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
Sparticuzcommented, Nov 21, 2014

I also had a problem with it deleting my dist folder with this code

del(['dist/**','!dist/sftp-config.json']);

after changing it to the below, it worked

del(['dist/**/*','!dist/sftp-config.json']);
4reactions
ralyodiocommented, Oct 15, 2014

I have a ./dist/.git directory I need to preserve when running gulp clean:dist…how can I do that?

I’ve tried all the suggestions, they don’t work.

gulp.task('clean:dist', function(cb){
    del(['dist/**/*', '!dist/.git/**/*'], { dot: true }, cb);
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Negating a pattern in gitignore isn't working - Stack Overflow
I tried the commented patterns in a .gitignore file in the directory immediately above the files I want to unignore, but had the...
Read more >
Negation not working when pattern begins with ! #62 - GitHub
Beginning a pattern with ! seems to be broken. The result actually matches the non-negated pattern... so for example: glob('!package.json', ...
Read more >
Lookahead and Lookbehind Zero-Length Assertions
Negative lookahead is indispensable if you want to match something not followed by something else. When explaining character classes, this tutorial explained ...
Read more >
Python tip 12: negate a regex grouping - learnbyexample
)* matches a character only if the current and next two characters are not par . The * quantifier is applied on the...
Read more >
Performing pattern negation to multiple nodes - Neo4j
A common incorrect approach does not use collections, but assumes (wrongly) that the pattern negated treats the variable values as a collection. Cypher....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found