alter
alter

Reputation: 333

Error running simple copy task with grunt

why cant I run this simple defined task with grunt? :

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

but when i try to run that task i get this warning:

$ 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.

is a very simple task, uglify and other tasks i had made works perfect.

Upvotes: 0

Views: 68

Answers (1)

Pete TNT
Pete TNT

Reputation: 8403

The cwd property of files should be an string not an Array.

Fixed task:

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

Output:

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


Done, without errors.

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

Upvotes: 2

Related Questions