Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grunt-contrib-copy task is failing when cwd option is specified

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.

like image 754
Capaj Avatar asked Oct 31 '13 15:10

Capaj


1 Answers

You need to add expand:true

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

like image 137
plus- Avatar answered Oct 20 '22 13:10

plus-