TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Objectified – An all JSON-HTML templating engine – in Node or Browser

2 点作者 delmarc将近 11 年前

2 条评论

krapp将近 11 年前
I can appreciate that this scratches your itch but the premise isn&#x27;t really that unique - I&#x27;ve been using daffl&#x2F;dform for instance when I want to generate forms from json.<p>My problem with things like this is I don&#x27;t see the benefit of the abstraction.<p>admittedly Objectified.render({ tagName:&quot;p&quot;, attributes:{ innerHTML:&quot;some nice text&quot; } });<p>is slightly less verbose than var p = document.createElement(&quot;p&quot;); p.appendChild(document.createTextNode(&quot;some nice text&quot;));<p>But both would probably become unwieldy and difficult to manage if you were building a complex document. One benefit to me of having templates which look like actual html is that they make it easier to reason about what the actual document is going to look like. The purely json or &quot;replace tags with significant whitespace&quot; seems to add syntactic sugar without obvious benefit.<p>Although, again admittedly, if you&#x27;re more comfortable with those then for you, it&#x27;s a benefit having everything look the same.
评论 #7813242 未加载
icedchai将近 11 年前
Gross. It&#x27;s not a &quot;templating engine&quot; if you have to convert your HTML to a JSON data structure, like in the example.
评论 #7813301 未加载