【问题标题】:JS to Text templating engine (asp.net-like)JS to Text 模板引擎(类似asp.net)
【发布时间】:2012-12-29 11:06:11
【问题描述】:

有没有类似 Microsft 的 T4 或类似 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 () {};
<#      
    }
}
#>

澄清:

我想要的是编写与多行文本 sn-ps 混合的 javascript,这是一种比 moustashe.js 和喜欢的语法更甜的野兽。

【问题讨论】:

    标签: javascript code-generation


    【解决方案1】:

    那些被称为pure javascript engines。这些天它们似乎不受欢迎。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-25
      • 1970-01-01
      • 1970-01-01
      • 2023-03-10
      • 1970-01-01
      • 2012-02-15
      • 1970-01-01
      • 2021-06-16
      相关资源
      最近更新 更多