【问题标题】:Grunt jade error咕噜玉错误
【发布时间】:2016-01-10 14:34:44
【问题描述】:

每当我运行 grunt Jade 时都会出现错误:

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中的玉文件(包括子目录,_include除外)放在build中,保持目录结构。我尝试评论expand 行,但它给了我:

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

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

【问题讨论】:

    标签: javascript node.js gruntjs grunt-contrib-jade


    【解决方案1】:

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

    但是你的文件定义还有其他问题:

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

    所以你需要:

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

    【讨论】:

    • 数组是我的问题。我刚刚添加了 ext 和 cwd 选项来尝试修复错误。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-20
    • 2021-01-19
    • 1970-01-01
    • 1970-01-01
    • 2013-03-07
    • 1970-01-01
    相关资源
    最近更新 更多