Grunt-contrib-copy task is failing when cwd option is specified
Asked Answered
S

1

10

I have this grunt-copy setup:

copy: {
        images: {
            cwd: 'src/multiselect/lib/',
            src: 'chosen.css',
            dest: './built/css/',
            flatten: true,
            filter: 'isFile'
        }
    },

And when I run it, it always goes:

Running "copy:images" (copy) task
Warning: Unable to read "chosen.css" file (Error code: ENOENT). Use --force to continue.
Aborted due to warnings.

The weird thing is that if I run it with this config:

copy: {
        images: {
            src: 'src/multiselect/lib/chosen.css',
    //      src: 'chosen.css',
            dest: './built/css/',
            flatten: true,
            filter: 'isFile'
        }
    },

It works every time. Does anyone have a clue as to why? It seems like the error occurs on this line of code:

grunt.file.copy(src, dest, copyOptions); 

In grunt-contrib-copy task. Any help would be greatly appreciated.

Slipslop answered 31/10, 2013 at 15:20 Comment(0)
A
15

You need to add expand:true

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

Acetometer answered 31/10, 2013 at 15:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.