繁体   English   中英

使用grunt运行简单复制任务时出错

[英]Error running simple copy task with grunt

为什么我不能用咕unt声来运行这个简单定义的任务?

        copy: {
          templates: {
            files: [{
                expand: true,
                cwd: ['src/tpl'],
                src: ['**/*.tpl'],
                dest: 'dist/assets/tpl'
            }]
          }
        }

但是当我尝试运行该任务时,会收到以下警告:

$ grunt copy:templates
Running "copy:templates" (copy) task
Verifying property copy.templates exists in config...ERROR
>> Unable to process task.
Warning: Required config property "copy.templates" missing. Use --force to continue.

Aborted due to warnings.

这是一个非常简单的任务,丑化和我完成的其他任务都很完美。

filescwd属性应该是string而不是数组。

固定任务:

copy: {
  templates: {
    files: [{
        expand: true,
        cwd: 'src/tpl',
        src: ['**/*.tpl'],
        dest: 'dist/assets/tpl'
    }]
  }
}

输出:

C:\Foo>grunt copy
Running "copy:templates" (copy) task


Done, without errors.

参考: http//gruntjs.com/configuring-tasks#building-the-files-object-dynamically

暂无
暂无

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

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