1

I have a gulp task like this:

const dest_free = "build/free";

gulp.task("build-free", ["clean-free"], function () {
  gulp.src(["src/**", "!src/composer.*", "LICENSE", "src/plugins/index.php", "!src/plugins/**"])
      .pipe(gulp.dest(dest_free));
});

My dir structure:

$ ls -F src/plugins/
RecipeIndex/    VisitorRating/  index.php

I'm expecting index.php to be in build/free/plugins/ but it's not:

$ ls -F build/free/plugins/
$ 

My questions:

  1. How can I debug this issue, first of all? How would I get the result that the gulp glob is producing? Any article or material would be appreciated.
  2. Why isn't index.php showing up in build/free/plugins/?

P.S.: Changing gulp glob order to this doesn't make a difference: ["src/**", "!src/composer.*", "LICENSE", "!src/plugins/**", "src/plugins/index.php"]

Gezim
  • 7,112
  • 10
  • 62
  • 98
  • Does this help? http://stackoverflow.com/questions/21806925/get-the-current-file-name-in-gulp-src You can use gulp-debug to get the files that the glob produces. – Cassidy Laidlaw Feb 01 '16 at 04:22
  • For your question 2, see this guy's excellent answer at https://stackoverflow.com/questions/46319426/gulp-exclude-does-not-work-as-expected/46326986#46326986. Basically the negation is performed last, so your result with index.php not being included is the expected result. See the referred question for options. – Mark Apr 14 '18 at 20:27

1 Answers1

0

To expand on @Cassidy Laidlaw's commment you can try the following, or the other options from this previous post to debug:

var debug = require('gulp-debug');

gulp.task('build-free', ['clean-free'], function() {
  return gulp.src(['src/**', '!src/composer.*', 'LICENSE', 'src/plugins/index.php', '!src/plugins/**'])
    .pipe(debug())
    .pipe(gulp.dest('build/free'));
});

This will output lines to the console like:

[22:23:05] gulp-debug: LICENSE
[22:23:05] gulp-debug: 1 item
Benjineer
  • 1,530
  • 18
  • 22