2016-04-02 21 views
0

シンプルコピータスクを実行中にエラーが発生しました

 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. 

するのは非常に簡単な作業、uglifyと私は作品が完璧に作られていた他のタスクです。

+0

http://gruntjs.com/configuring-tasks#building-the-files-object-dynamicallyはおそらく全体gruntfileを含むように役立つだろう。 – steveax

答えて

2

cwdのプロパティfilesは、配列ではなく、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. 

参考:

関連する問題