Reputation: 840
Currently i use this to compile it to a file:
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
I dont get it to compile it directly to javascript :S
Upvotes: 0
Views: 2193
Reputation: 14434
what connor said (got an upvote from me).
as an alternative you could use grunt.js with thegrunt-coffee plugin if you want to use the "atthemomentstandardjavascriptbuildtool" ;-)
Upvotes: 1
Reputation: 7181
You need to define your tasks in a Cakefile
, then invoke that Cakefile. Run cake build
in your terminal from the directory where your coffeescript files reside, after putting a Cakefile
in the same directory. Here's a simple template for a Cakefile. It already has the build function written in as described below: 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
Upvotes: 2