2010年2月28日日曜日

CouchApp !code macro recursion.

I wrote the patch about !code macro behavior several months ago. and now an official topic branch was created by jchris's gread help.

Please check it out from http://github.com/couchapp/couchapp/tree/recursive-macros.

This should be helpful for making your javascript library more flexible.

Here is an example:

approot/lib/a.js is:

// !code b.js
function a(){};

approot/lib/b.js is:

function b(){};

and approot/show/test.js is:

function(doc, req){
   // !code lib/a.js
   ..
}

The current version of couchapp deploys the approot/_show/test as:

function(doc, req){
   // !code b.js
   function a(){};
   ..
}

b.js is not extracted by !code macro.

After applying my patch, the deployed code is:

function(doc, req){
   function b(){};
   function a(){};
   ..
}

0 件のコメント: