AsyncTpl
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:AsyncTpl — asynchronous template engine for nodejs or the browser. (Development of the project is closed)
# AsyncTpl (closed)

Is a asynchronous template engine for nodejs or the browser.


## Features

* [XML](#xml-syntax), [Smarty](#smarty) or custom syntaxis
* async/streaming operation
* [compile](#compile-errors) & [run-time](#run-time-errors) errors
* browser/nodejs compatibility
* [high performance](https://github.com/RubaXa/AsyncTpl/tree/master/benchmark)
* 10KB (minified + gzipped)


## Usage

### NodeJS

#### index.js
```js
var xtpl = require('./lib/AsyncTpl').engine('XML');

// Setup XML
xtpl.NS     = 'xtpl';   // namespace
xtpl.ASYNC  = true;     // async include templates
xtpl.STREAM = false;    // streaming
xtpl.ESCAPE = true;     // html escape all variables
xtpl.DEBUG  = true;     // compile & run-time errors (console.log)
xtpl.ROOT_DIR       = './tpl/';
xtpl.COMPILE_DIR    = './tpl_c/';

http.createServer(function (req, res){
	res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
	xtpl.fetch(
	  'index.xml'
	, {
		  text: 'Yahoo!'
		, items: [{ selected: true, href: '/', text: 'index' }, { href: '/page', text: 'page' }]
	}
	, function (result){
		res.end(result);
	});
}).listen(8082);
```

#### default.xml -- default page
```html


	
	
		
			
			Default page
		
		
			

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。