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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

A templating library based on JavaScript tagged template literals

3 点作者 msurdi大约 2 年前

2 条评论

msurdi大约 2 年前
Hi folks,<p>A couple years ago I started this small project for doing &quot;old style&quot; server templates but in a much more modern way and wanted to share it here. I&#x27;d appreciate any feedback you might have or any ideas to improve it if you have any.<p>I know nowadays doing &quot;old style&quot; templates is pretty out of fashion for many of us, but when working just myself on some side projects I felt like using a full blown modern &quot;SPA&quot; framework such as React or Vue was overkill, so I opted for doing plain old server templates with Stimulus.js sprinkles for the client side interactivity.<p>I tried EJS, Handlebars, Nunjucks, and a few others but after having enjoyed the support you get for TypeScript, Intellisense, syntax highlighting, autoformatting and other benefits that you get when using JSX, I felt like the existing templating solutions were way too out of date.<p>So I gave it a spin and ended up building this. It looks a bit like JSX and it&#x27;s actually inspired in lit-html, except it&#x27;s simplified to the maximum (implementation is about 70 lines) and works both in the browser and on the server.<p>Thanks for any feedback.<p>NPM package: <a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;html-string" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;html-string</a><p>Github repo: <a href="https:&#x2F;&#x2F;github.com&#x2F;msurdi&#x2F;html-string">https:&#x2F;&#x2F;github.com&#x2F;msurdi&#x2F;html-string</a>
earthboundkid大约 2 年前
This are lots of JS templating libraries that use tagged literals. It would be odd to release a templating library in 2023 that didn&#x27;t use tagged literals.