Liquid 模板标记可以在 Coffeescript 中使用吗?

发布于 2025-01-02 14:11:44 字数 160 浏览 4 评论 0原文

这两种是 Jekyll 静态站点生成过程中流行的技术。是否可以在 Coffeescript 中使用 Liquid 标记,以便 Jekyll 生成包含 Liquid 插入的最终 Javascript?

These two are popular technos that come with the Jekyll static site generation. Is it possible to use Liquid markup inside Coffeescript so that Jekyll produces a final Javascript that includes the insertion from Liquid?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

染柒℉ 2025-01-09 14:11:44

不——或者至少不容易。

首先,Coffeescript 并不是与 Jekyll 一起“出现”的,至少不是与“普通”Jekyll 一起出现的。

您可以将一个扩展添加到 Jekyll 中,用于预处理 Coffeescript 并将其转换为 javascript。此扩展解析所有 *.coffee 文件并将其转换为 *.js 文件。液体处理器不参与其中。

您可以尝试修改涉及液体的扩展名,但这并不容易。

另外,作为一个扩展意味着它不能直接在 github 页面中使用,这可能会令人沮丧。

No - or at least not easily.

First of all, Coffeescript doesn't "come" with Jekyll, at least not with the "vanilla" Jekyll.

There is an extension that you can add to Jekyll that preprocesses Coffeescript and transforms it into javascript. This extension parses all *.coffee files and transforms it into *.js files. The Liquid processor isn't involved.

You could try modifying the extension son liquid is involved, but that's not easy.

Also, being an extension means that it can't be used in github pages directly, which might be a downer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文