Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a readme and a url .

  • Loading branch information...
commit 480582b5f7df76a6d7578167ddfc42d5b7cc15e3 1 parent 623ee74
@ryanramage ryanramage authored
Showing with 101 additions and 0 deletions.
  1. +100 −0 README.md
  2. +1 −0  kanso.json
View
100 README.md
@@ -0,0 +1,100 @@
+## node.couchapp.js support
+
+This kanso package lets you build couchapps in the [node.couchapp.js](https://github.com/mikeal/node.couchapp.js) style of project.
+
+## Install
+
+Add to your project's kanso.json dependencies setting, here is the minimal
+case:
+
+```json
+{
+ "app": "app",
+ "dependencies": {
+ "node-couchapp": null
+ }
+}
+```
+
+Notice the app property. The value is 'app' which means look for a file called 'app.js'.
+
+Run kanso install to install in your packages directory:
+
+```
+kanso install
+```
+
+
+## app.js example:
+
+<pre>
+ var couchapp = require('couchapp')
+ , path = require('path');
+
+ ddoc = {
+ _id: '_design/app'
+ , views: {}
+ , lists: {}
+ , shows: {}
+ }
+
+ module.exports = ddoc;
+
+ ddoc.views.byType = {
+ map: function(doc) {
+ emit(doc.type, null);
+ },
+ reduce: '_count'
+ }
+
+ ddoc.views.peopleByName = {
+ map: function(doc) {
+ if(doc.type == 'person') {
+ emit(doc.name, null);
+ }
+ }
+ }
+
+ ddoc.lists.people = function(head, req) {
+ start({
+ headers: {"Content-type": "text/html"}
+ });
+ send("&lt;ul id='people'>\n");
+ while(row = getRow()) {
+ doc = row.doc;
+ send("\t&lt;li class='person name'>" + doc.name + "&lt;/li>\n");
+ }
+ send("&lt;/ul>\n")
+ }
+
+ ddoc.shows.person = function(doc, req) {
+ return {
+ headers: {"Content-type": "text/html"},
+ body: "&lt;h1 id='person' class='name'>" + doc.name + "&lt;/h1>\n"
+ }
+ }
+
+ couchapp.loadAttachments(ddoc, path.join(__dirname, '_attachments'));
+</pre>
+
+
+## Options
+
+If you are including a node.couchapp.js style project into another kanso app, the design docs will get merged.
+The exception is 'rewrites'. This can't be merged very well, so there is an option to prepend the included rewrites. Here is how:
+
+```json
+{
+ "app": "app",
+ "node-couchapp" : {
+ "merge-rewrites" : true
+ },
+ "dependencies": {
+ "node-couchapp": null
+ }
+}
+```
+
+
+
+
View
1  kanso.json
@@ -1,5 +1,6 @@
{
"name": "node-couchapp",
+ "url" : "https://github.com/kanso/node-couchapp",
"version": "0.8.2",
"categories": ["build-tools"],
"description": "adds a build step using node.couchapp.js",
Please sign in to comment.
Something went wrong with that request. Please try again.