我正在研究一种在 CQ5 中使用 Mustache 模板化 View 引擎的方法,该引擎使用 Sling。如果有人已经有这方面的经验,我正在寻求一些建议。
我需要使用一种可以在需要时在前端和后端之间共享的模板格式。因此, mustache 是理想的选择,但是,其他选项也可能适用,例如 Handlebars 。
我找到了一个“sling-scripting-mustache”的 git 存储库,我正在研究它,但它缺少任何类型的文档。尽管如此,我还是会尝试一下。
非常感谢任何想法和指导:)
最佳答案
Handlebars 自 5.6 起就已出现在 CQ 中:
The handlebars javascript library was originally added to CQ in 5.6.0 for other purposes. The java version of handlebars is included in AEM 6.0, and in a featurepack for 5.6.1 that contains the Social Component Framework (SCF) (source)
您可以编写 Mustache 模板并使用 Handlebars 渲染它们:
Mustache templates are compatible with Handlebars, so you can take a Mustache template, import it into Handlebars, and start taking advantage of the extra Handlebars features (source)
还有更多信息 here .
关于java - mustache +吊带+CQ5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16092022/