razor-tmpl https://github.com/magicdawn/razor-tmpl https://www.npmjs.org/package/razor-tmpl
##1.安装 npm i razor-tmpl -g
##2.文件准备
###2.1模板 index.razor
@{
    var data = require('./data.json'); //require support
    require('colors');//third party module support,also native module
    console.log("i required the %s file,and title is : %s","data.json".rainbow,data.title.yellow);
}
<!doctype html>
<html>
    <head>
        <title>@(data.title)</title>
        <!-- __filename support -->
        @( __dirname )
        <!-- __filename support -->
        @( __filename )
    </head>
</html>
@{ console.log($result.cyan); }
###2.2data.json
{
    "title" : "this is a title"
}
##3.执行 razor index
会生成index.html,不需要执行 node xxx.js 这种js文件参与
在template里可以 require fs/path模块,然后还有 __dirname/__filename支持,可以自己输出内容,razor命令行调用时,使用 -no-output让模板自己输出内容…

这个测试可见于 https://github.com/magicdawn/razor-tmpl/tree/master/nodejs/razor-tmpl/test/bin%E5%B7%A5%E5%85%B7
博客http://magicdawn.github.io/2014/08/12/nodejs-module-require/
 
       
       
       
       
       
    