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:

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

approot/lib/b.js is:

  1. function b(){};  

and approot/show/test.js is:

  1. function(doc, req){  
  2.    // !code lib/a.js  
  3.    ..  
  4. }  

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

  1. function(doc, req){  
  2.    // !code b.js  
  3.    function a(){};  
  4.    ..  
  5. }  

b.js is not extracted by !code macro.

After applying my patch, the deployed code is:

  1. function(doc, req){  
  2.    function b(){};  
  3.    function a(){};  
  4.    ..  
  5. }  

0 件のコメント: