目前我使用它将其编译为文件:
task 'CurrentVillage', 'Build Current Vilage', ->
remaining = appFiles.length
appContents = new Array remaining
for file, index in appFiles then do (file, index) ->
fs.readFile "media/coffee/#{file}.coffee", 'utf8', (err, fileContents) ->
throw err if err
appContents[index] = fileContents
process() if --remaining is 0
process = ->
fs.writeFile 'media/coffee/frontend/VillageCanvas.coffee', appContents.join('\n\n'), 'utf8', (err) ->
throw err if err
我没有把它直接编译成javascript:S
答案 0 :(得分:1)
您需要在Cakefile
中定义任务,然后调用Cakefile。在将cake build
放在同一目录中后,从您的coffeescript文件所在的目录中运行终端中的Cakefile
。这是Cakefile的简单模板。它已经具有如下所述编写的构建函数:http://twilson63.github.com/cakefile-template/
build = (watch, callback) ->
if typeof watch is 'function'
callback = watch
watch = false
options = ['-c', '-b', '-o', 'lib', 'src']
options.unshift '-w' if watch
launch 'coffee', options, callback
答案 1 :(得分:1)
作为替代方案,如果您想使用“atthemomentstandardjavascriptbuildtool”,则可以将grunt.js与grunt-coffee plugin一起使用; - )