简体   繁体   English

咕噜玉错误

[英]Grunt jade error

Whenever I run grunt jade I get an error: 每当我运行咕噜翡翠时,我都会收到错误:

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

Now here is my jade task: 现在这是我的玉任务:

    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/'
            }
        }
    }

So basically I am trying to take the jade files in src/static/jade (including subdirs, except _include ) and put them in build , keeping the directory structure. 所以基本上我试图在src/static/jade (包括子目录,除了_include )中获取jade文件并将它们放在build ,保持目录结构。 I have tryed commenting the expand line, however it gives me: 我试过评论expand线,但它给了我:

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

Perhaps I am going about this the wrong way. 也许我会以错误的方式解决这个问题。 How should I fix this? 我该怎么解决这个问题?

Your initial issues is that files should be an array of objects, not just an object: files: [{...}] . 您最初的问题是files应该是一个对象数组,而不仅仅是一个对象: files: [{...}]

But then you have other troubles with your file definition: 但是你的文件定义还有其他麻烦:

  • if you specify cwd , your src should not repeat it 如果你指定cwd ,你的src不应该重复它
  • your ext needs a starting . 你的ext需要一个开始.
  • your ! 您的 ! pattern needs to specify files instead of a dir pattern需要指定文件而不是dir

So you need: 所以你需要:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM