Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gulp 4 Alpha 3 not handling src correctly #2093

Closed
Dan503 opened this issue Jan 9, 2018 · 8 comments
Closed

Gulp 4 Alpha 3 not handling src correctly #2093

Dan503 opened this issue Jan 9, 2018 · 8 comments
Assignees

Comments

@Dan503
Copy link

Dan503 commented Jan 9, 2018

What were you expecting to happen?

I have this basic copy task:

  gulp.task('copy:scripts', () => {
    return gulp.src([
      'src/_scripts/**/*',
      '!src/_scripts/{**/\_*,**/\_*/**}',
    ])
    .pipe(gulp.dest('app/scripts'));
  })

What should happen is that it looks in the src/_scripts folder and copies everything inside it into the app/scripts folder. It should ignore any file that either starts with an underscore, or is held in a folder that starts with an underscore.

What actually happened?

It doesn't seem to understand the !src/_scripts/{**/\_*,**/\_*/**} syntax any more. I had to break it out into seperate "not" strings. It also didn't handle the "base" setting automatically like it is supposed to. It ended up saving the files into app/scripts/src/_scripts instead of app/scripts/. To fix the issues This is what I ended up with.

  gulp.task('copy:scripts', () => {
    return gulp.src([
      'src/_scripts/**/*',
      '!src/_scripts/**/\_*',
      '!src/_scripts/**/\_*/**',
    ], { base: 'src/_scripts' })
    .pipe(gulp.dest('app/scripts'));
  })

What version of gulp are you using?

Gulp 4.0.0 aka 4-alpha.3

What versions of npm and node are you using?
npm: 5.5.1
Node: 6.12.0

(I know my node is out of date, I have a project that requires Node 6 to work)

@phated
Copy link
Member

phated commented Jan 9, 2018

@jonschlinkert @doowb can you guys help out here?

@doowb
Copy link
Member

doowb commented Jan 9, 2018

I'll take a look in a little bit.

@doowb
Copy link
Member

doowb commented Jan 10, 2018

@Dan503 I'm not able to reproduce the issue that you're having. I used nvm to switch to node 6.12.0 to make sure it wasn't a node version.

I also installed gulp and gulp-cli with the following commands:

npm i -g gulp-cli
npm i gulp@next

@doowb
Copy link
Member

doowb commented Jan 10, 2018

I created a repo with some mock files to show what I'm seeing: https://github.com/doowb/gulp-issue-2093.git

@Dan503 let me know if the folder structure looks like what you're expecting.

@Dan503
Copy link
Author

Dan503 commented Jan 10, 2018

I'm not able to take a look right now, can you check gulp.watch is working in the mean time?
#2094

@Dan503
Copy link
Author

Dan503 commented Jan 10, 2018

In the reduced test case that you created, it looks like it's all working as expected. It must be an issue with my set up.

Thanks for creating the test environment. I'll close the watch issue as well. It seems like that is working on your test environment as well.

@Dan503
Copy link
Author

Dan503 commented Jan 10, 2018

I created a pull request in your mini gulp set up that is able to successfully replicate the issue
doowb/gulp-issue-2093#1

@Dan503 Dan503 reopened this Jan 10, 2018
@doowb
Copy link
Member

doowb commented Jan 10, 2018

@Dan503 as @jonschlinkert points out in this comment you shouldn't be using path methods on the glob patterns. Instead, pass the patterns like you do in the original example and use the cwd option when specifying the working directory is necessary.

I'm going to close this since it isn't a bug.

@doowb doowb closed this as completed Jan 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants