Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 用Cakefile编译CoffeeScript_Javascript_Compiler Construction_Coffeescript - Fatal编程技术网

Javascript 用Cakefile编译CoffeeScript

Javascript 用Cakefile编译CoffeeScript,javascript,compiler-construction,coffeescript,Javascript,Compiler Construction,Coffeescript,目前我使用它将其编译为一个文件: 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',

目前我使用它将其编译为一个文件:

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

您需要在
Cakefile
中定义任务,然后调用该Cakefile。将
Cakefile
放入同一目录后,从coffeescript文件所在的目录在终端中运行
cakebuild
。这里有一个简单的Cakefile模板。它已经具有编写的构建功能,如下所述:


您需要在
Cakefile
中定义任务,然后调用该Cakefile。将
Cakefile
放入同一目录后,从coffeescript文件所在的目录在终端中运行
cakebuild
。这里有一个简单的Cakefile模板。它已经具有编写的构建功能,如下所述:

康纳说的话(得到了我的赞成票)

如果您想使用“AtthementStandardJavaScriptBuildTool”;-)的话,也可以使用

康纳说的话(得到了我的支持)


如果您想使用“AtthementStandardJavaScriptBuildTool”;-)的话,也可以使用

这个问题只编译src中的文件。我想编译组合代码。我不想保存组合的咖啡文件。请将
Cakefile
放在目录的根目录中,然后从那里运行
cake build
。问题是,这只编译src中的文件。我想编译组合代码。我不想保存组合的咖啡文件。请将
Cakefile
放在目录的根目录中,然后从那里运行
cake build
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