Skip to content

Added coffeescript support to couchapp#26

Open
josephg wants to merge 2 commits intomikeal:masterfrom
josephg:master
Open

Added coffeescript support to couchapp#26
josephg wants to merge 2 commits intomikeal:masterfrom
josephg:master

Conversation

@josephg
Copy link

@josephg josephg commented Aug 31, 2011

If you don't have coffeescript installed, it works like normal. If you have coffeescript installed + visible to require, you can:

$ couchapp push app.coffee http://localhost:5984/ctest

@shimaore
Copy link

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:

    • by enclosing the coffescript code in ''' (to make sure it does not get compiled); should work but prevents to use e.g. ''' in coffeescript code;
    • by using things like 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.

@elistevens
Copy link

Any movement on this? I'd love to have coffee support.

@clehner
Copy link

clehner commented Apr 29, 2013

👍 yes please 🍦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants