Liquid 模板标记可以在 Coffeescript 中使用吗?
这两种是 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不——或者至少不容易。
首先,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.