Javascript JS到文本模板引擎(类似asp.net)

Javascript JS到文本模板引擎(类似asp.net),javascript,code-generation,Javascript,Code Generation,是否有类似MicrosoftT4或ASP.NET的模板引擎,可以用JS编写模板来生成文本(或其他代码) 例如(其中,“这些被称为。它们现在似乎不受欢迎 <# ...here goes template building code... for(var i = 0; i < types.length; i++) { #> function <#= types[i].name #> () { } <# for(var j = 0; j &

是否有类似MicrosoftT4或ASP.NET的模板引擎,可以用JS编写模板来生成文本(或其他代码)

例如(其中,“这些被称为。它们现在似乎不受欢迎

<#
...here goes template building code...
for(var i = 0; i < types.length; i++) {
#>
    function <#= types[i].name #> () {

    }
<#
    for(var j = 0; j < types[i].methods.length; j++) {
#>
    <#= types[i].name #>.prototype.<#= types[i].methods[j].name #> = function () {};
<#      
    }
}
#>