在我的Gruntfile.js中,我将咖啡任务配置为如此,script.coffee
目录中存在一个文件src/
:
coffee: {
dist: {
files: [{
/* FIX: exapand: true, */
expand: true,
cwd: 'src/',
src: '**/*.coffee',
dest: 'lib/',
ext: '.js'
}]
}
}
运行grunt coffee
时,我收到以下错误:
Running "coffee:dist" (coffee) task
>> Source file "script.coffee" not found.
>> Destination (lib/) not written because compiled files were empty.
script.coffee
的内容只是测试coffeescript配置的一些代码,当我从命令行运行coffee -c script.coffee
时,编译完美。
script.coffee :
# A bubble sort implementation, sorting the given array in-place.
bubble_sort = (list) ->
for i in [0...list.length]
for j in [0...list.length - i] when list[j] > list[j + 1]
[list[j], list[j+1]] = [list[j + 1], list[j]]
list
# Test the function.
console.log bubble_sort([3, 2, 1]).join(' ') is '1 2 3'
console.log bubble_sort([9, 2, 7, 0, 1]).join(' ') is '0 1 2 7 9'
我在其他地方有其他项目使用相同的配置...我只是可以;弄清楚问题......
任何人都有见解?
答案 0 :(得分:2)
files: [{ exapand: true ... }]
中有拼写错误,应为expand: true
。