admin管理员组

文章数量:1289496

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. I have tryed menting the expand line, however it gives me:

 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?

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. I have tryed menting the expand line, however it gives me:

 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?

Share Improve this question asked Oct 13, 2015 at 1:06 Kaiden PrinceKaiden Prince 4723 silver badges18 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 13

Your initial issues is that files should be an array of objects, not just an object: files: [{...}].

But then you have other troubles with your file definition:

  • if you specify cwd, your src should not repeat it
  • your ext needs a starting .
  • your ! pattern needs to specify files instead of a dir

So you need:

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

本文标签: javascriptGrunt jade errorStack Overflow