.gitignore and .eleventyignore don’t support negative patterns #4026
Replies: 8 comments
-
|
Edit Maybe not a duplicate, but related to #677? |
Beta Was this translation helpful? Give feedback.
-
|
Yeah. Pretty much a duplicate. If you don't have an .eleventyignore file it will use the gitignore by default. But that explains why my searches for existing bugs didn't find anything. |
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
-
|
Placing this into the enhancement queue. #677 is a related issue to this but not quite the same. As info, v0.10.0 will include a debug warning if it encounters one of these entries. |
Beta Was this translation helpful? Give feedback.
-
|
I was hit by this. My use case is I use Sass so I want to In case it helps, For others landing here, I worked around it by setting |
Beta Was this translation helpful? Give feedback.
-
|
A note for future me: Two dependencies require some level of support here: In 1.0 we’ll use fast-glob’s These will both need to be tested to know if negated patterns are supported in the |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Cross link to https://www.npmjs.com/package/parse-gitignore or https://www.npmjs.com/package/@humanwhocodes/gitignore-to-minimatch or https://www.npmjs.com/package/ignore |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
.eleventyignorefiles that use negative ignore patterns return unexpected results because eleventy modifies the paths a bit.To Reproduce
Steps to reproduce the behavior:
Expected behavior
Negative patterns should allow you to re-include ignored paths
Environment:
Additional context
Eleventy modifies the patterns in the ignore file by prefixing a relative path header (
./) and then adding the!to the beginning. As a result, the example above (!site/events/2018/**) gets turned into!./!site/events/2018/**when being passed to fast-glob. Fast glob processes negative patterns separately so it pulls that pattern out and removes the ! and actually strips the ./ before using it, so it ends up using!site/events/2018/**as the negative pattern and this basically says ignore anything that's not a match forsite/events/2018. Sincesite/eventsis not a match for this, the whole folder gets excluded and fast-glob never scans any deeper for files that SHOULD be included.I haven't had a chance to try it out yet, but this problem could potentially be solve by not modifying the patterns in
.eleventyignoreand using the newignoreparameter to fast-glob which handles the negation for you. I haven't looked too closely at what modifications eleventy does to see if they're necessary for some of the output processing so hopefully it's just not necessary.Note: This is a new issue related to the upgrade to fast-glob 3.X. Definitely prefer to use the new version, but would love to have it continue to use .eleventyignore the same way I was before.
Beta Was this translation helpful? Give feedback.
All reactions