我有这个grunt-copy设置:
copy: {
images: {
cwd: 'src/multiselect/lib/',
src: 'chosen.css',
dest: './built/css/',
flatten: true,
filter: 'isFile'
}
},
当我运行它时,它始终是:
Running "copy:images" (copy) task
Warning: Unable to read "chosen.css" file (Error code: ENOENT). Use --force to continue.
Aborted due to warnings.
奇怪的是,如果我用这个配置运行它:
copy: {
images: {
src: 'src/multiselect/lib/chosen.css',
// src: 'chosen.css',
dest: './built/css/',
flatten: true,
filter: 'isFile'
}
},
每次都有效。有没有人知道为什么?似乎错误发生在这行代码上:
grunt.file.copy(src, dest, copyOptions);
在grunt-contrib-copy任务中。任何帮助将不胜感激。
答案 0 :(得分:15)
您需要添加expand:true
请参阅http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically