0

目前我用它来编译它到一个文件:

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

4

2 回答 2

2

您需要在 a 中定义您的任务Cakefile,然后调用该 Cakefile。将 a放入同一目录cake build后,从您的咖啡脚本文件所在的目录在终端中运行。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
于 2013-01-04T21:26:43.167 回答
1

康纳说了什么(得到了我的赞成)。

作为替代方案,如果您想使用“atthemomentstandardjavascriptbuildtool”,您可以将grunt.jsgrunt-coffee 插件一起使用;-)

于 2013-01-04T22:05:06.127 回答