开发者评论在车把中,但客户端没有输出

Alv*_*aro 0 javascript handlebars.js express-handlebars

我使用 Express Handlebars 作为节点的模板引擎。我知道可以选择添加 HTML 注释,但是有没有办法添加不会打印在最终源代码上的开发人员注释?

这是我发现的:

{{! This comment will not be in the output }}
<!-- This comment will be in the output -->
Run Code Online (Sandbox Code Playgroud)

但寻找:

{{! This comment should only be visible in the source file, not in the client side }}
Run Code Online (Sandbox Code Playgroud)

类似于 PHP 中视图中可以完成的操作:

<?php
/* Comment here */
?>
Run Code Online (Sandbox Code Playgroud)

Alv*_*aro 5

正确答案是:

{{!-- This comment won't get printed in this view --}}
Run Code Online (Sandbox Code Playgroud)

https://handlebarsjs.com/guide/#template-comments