Open josephg opened 13 years ago
Couple notes on 'coffeescript in node.couchapp'. The first one pertains to this pull request, the second item is more generic.
The simplest approach is a coffeescript app.coffee
; the _design
document's language is still javascript
.
This can be achieved from within a coffeescript installer (which mimics bin.js
):
#!/usr/bin/env coffee
couchapp = require 'couchapp'
push_script = (uri, script,cb) ->
couchapp.createApp require("./#{script}"), uri, (app)-> app.push(cb)
push_script 'http://127.0.0.1:5984/dbname', 'app'
My understanding is that this pull request does this for the command line couchapp
.
In both cases I believe loadFiles
still needs to be told when to expect coffeescript files with a proper options.operators
. There should be some sort of helper for that: ddoc.templates = loadFiles(dir, couchapp.coffeescript_helper)
.
There is now native coffeescript support in CouchDB (since 1.2.0). In this case the _design
document's language is coffeescript
.
I'm not sure how to do this for a main app.coffee
except:
'''
(to make sure it does not get compiled); should work but prevents to use e.g. '''
in coffeescript code;ddoc.views = loadFiles('views')
. This defeats the goal of node.couchapp to have things gathered in a single file.It looks like this would be a target for a coffeescript-specific tool.
Any movement on this? I'd love to have coffee support.
:+1: yes please :icecream:
If you don't have coffeescript installed, it works like normal. If you have coffeescript installed + visible to
require
, you can: