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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Pithy.js - An internal DSL for generating HTML in JavaScript

52 点作者 sdogruyol大约 12 年前

12 条评论

crabasa大约 12 年前
It is worth noting that the OP is calling this tool pithy (terse, meaningful). In an application I'm working on [1] I have several lines of jQuery and string concatenation to build some simple content.<p>It's probably overkill to use a full-blown client-side templating engine, but my current code leaves much to be desired. I think pithy.js might be a great fit.<p>[1] <a href="https://github.com/crabasa/seattlehacks/blob/gh-pages/calendar.html" rel="nofollow">https://github.com/crabasa/seattlehacks/blob/gh-pages/calend...</a>
sophacles大约 12 年前
This is almost identical in operation to laconic <a href="https://github.com/joestelmach/laconic" rel="nofollow">https://github.com/joestelmach/laconic</a> what advantages does this have?
atirip大约 12 年前
Nope. Avoid. Switch to templates at the moment you think you need this kind of a solution. Use for example super comoact <a href="http://archan937.github.com/templayed.js/" rel="nofollow">http://archan937.github.com/templayed.js/</a> Compared to almost full blown mustache implementation, pithy.js, surprise, is a bloat. Sorry of being harsh, as a positive note, the code itself, in abstract way is my liking. Very good. May even steal some snippets.
评论 #5488354 未加载
jimmytucson大约 12 年前
See also:<p><a href="http://github.com/markgandolfo/el.js" rel="nofollow">http://github.com/markgandolfo/el.js</a><p><a href="http://joestelmach.github.com/laconic/" rel="nofollow">http://joestelmach.github.com/laconic/</a><p><a href="http://domo-js.com/" rel="nofollow">http://domo-js.com/</a>
muxxa大约 12 年前
Almost identical functionality appears as part of MochiKit, and I've found it very useful for quick and clean DOM creation:<p><a href="http://mochi.github.com/mochikit/doc/html/MochiKit/DOM.html" rel="nofollow">http://mochi.github.com/mochikit/doc/html/MochiKit/DOM.html</a>
dropdownmenu大约 12 年前
Pretty cool project, but I feel kind of dirty having js and html being so tightly bound to each other. Do you have a specific use case where pithy would perform faster or be more cleanly implemented than standard templates?
评论 #5486588 未加载
评论 #5487024 未加载
Zelphyr大约 12 年前
Why is everyone so afraid of HTML that they insist on starting projects like this? I've seen them come and go for 15+ years now and they're never useful. Even less so in the case of using JS to generate HTML because that makes the browser actually work harder.<p>This isn't a knock against OP or the project creator (if they're not one and the same) because projects like these can be useful exercises. But I would never use something like this in production and I would hope nobody else would either.
评论 #5487350 未加载
评论 #5487046 未加载
spyder大约 12 年前
Also there is DOMBuilder <a href="https://github.com/insin/DOMBuilder" rel="nofollow">https://github.com/insin/DOMBuilder</a> which has separate modes for using HTML mock elements on (node.js) server-side or DOM elements in browsers. The mock elements are implementing only a very small set of the DOM functions, but if you extend it a little then it can be useful to share Backbone-like views between server and client.
grimtrigger大约 12 年前
Awesome! Would be useful if there were callbacks for binding events after the node has been created.
评论 #5486482 未加载
评论 #5486865 未加载
ajitk大约 12 年前
I prefer <a href="https://github.com/jed/domo" rel="nofollow">https://github.com/jed/domo</a> to create DOM elements in browser. Its output is a real DOM element whereas in pithy.js, its string.
评论 #5487357 未加载
Bjoern大约 12 年前
This is quite interesting, thank you for open sourcing it.<p>I can see how this can be helpful cleaning up e.g. common string concatenation snippets in code bases.
gohwell大约 12 年前
Pardon my ignorance... What is a DSL?
评论 #5488287 未加载