【问题标题】:debugging gulp glob patterns (node-glob)调试 gulp glob 模式(node-glob)
【发布时间】:2016-01-31 00:06:12
【问题描述】:

我有一个像这样的 gulp 任务:

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));
});

我的目录结构:

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

我希望 index.php 出现在 build/free/plugins/ 中,但事实并非如此:

$ ls -F build/free/plugins/
$ 

我的问题:

  1. 首先,我该如何调试这个问题?我如何得到 gulp glob 产生的结果?任何文章或材料将不胜感激。
  2. 为什么index.php 没有出现在build/free/plugins/ 中?

P.S.:将 gulp glob 顺序更改为此没有任何区别:["src/**", "!src/composer.*", "LICENSE", "!src/plugins/**", "src/plugins/index.php"]

【问题讨论】:

标签: build gulp node-glob gulp-glob


【解决方案1】:

要扩展@Cassidy Laidlaw 的评论,您可以尝试以下方法,或this 上一篇文章中的其他选项进行调试:

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'));
});

这将向控制台输出如下行:

[22:23:05] gulp-debug: LICENSE
[22:23:05] gulp-debug: 1 item

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-06
    • 1970-01-01
    • 2020-06-12
    • 2022-01-18
    • 2011-04-18
    • 1970-01-01
    相关资源
    最近更新 更多