咕噜玉错误

每当我运行咕噜玉,我得到一个错误:

Warning: pattern.indexOf is not a function Use --force to continue. 

现在,这是我的玉石任务:

  jade: { options: { pretty: true }, all: { files: { expand:true, cwd: 'src/static/jade', ext: "html", src: ['src/static/jade/**/*.jade', '!src/static/jade/_includes'], dest: 'build/' } } } 

所以基本上我试图把src/static/jade的jade文件(包括除了_include之外的_include )放到build ,保持目录结构。 我尝试了评论expand线,但它给了我:

  Warning: Unable to read "src/static/jade" file (Error code: EISDIR). Use --force to continue. 

也许我正在做这个错误的方式。 我应该如何解决这个问题?

你最初的问题是files应该是一个对象数组,而不仅仅是一个对象: files: [{...}]

但是你的文件定义还有其他的麻烦:

  • 如果你指定了cwd ,你的src不应该重复
  • 你的ext需要一个开始.
  • 你的 ! 模式需要指定文件,而不是一个目录

所以你需要:

 files: [{ expand:true, cwd: 'src/static/jade/', ext: ".html", src: ['**/*.jade', '!_includes/**/*.jade'], dest: 'build/' }]