larsonjj / generator-yeogurt

A generator for creating static sites. Helps you harness the power of your favorite tools: Pug or Nunjucks, Gulp, ES6/2015, and much more!
MIT License
542 stars 73 forks source link

path.join() should not be used for joining paths #231

Closed Dan503 closed 4 years ago

Dan503 commented 4 years ago

In this issue, the creators of Gulp themselves explain that path.join() should not be used for path concatenation because it causes the problem explained at the top of the issue.

https://github.com/gulpjs/gulp/issues/2085

A better method is to use a custom path joining function.

const join = (...pathSegments) => pathSegments.join('/')

console.log( join("path", "to", "file") )
// path/to/file
larsonjj commented 4 years ago

Hey @Dan503,

Agree with your assertion that path.join should not be used within Gulp 4 src() calls as it will potentially break globbing patterns (See more details in my previous comment from our last discussion here). However, I disagree that path.join should never be used and that a custom path joining function should be used instead. In the Issue you linked, the Gulp team recommends using the cwd option, which is what I have implemented for this project.

We have already discussed this at length in your previous PR, so I'd rather not rehash everything. Know that I appreciate your concern, just respectively disagree.

That being said, if you do notice issues pertaining to globs that are not working (or anything else), do not hesitate to create issues or PRs as it is very helpful.