Search code examples
javascripthandlebars.jsexpress-handlebars

Developer comments in handlebars with no output in client side


I'm using Express Handlebars as a template engine for node. I know there's an option to add HTML comments with it, but is there a way to add developer comments that won't get printed on the final source ?

This is what I found:

{{! This comment will not be in the output }}
<!-- This comment will be in the output -->

But looking for:

{{! This comment should only be visible in the source file, not in the client side }}

Similar to what can be done in PHP in a view:

<?php
/* Comment here */
?>

Solution

  • The correct answer is:

    {{!-- This comment won't get printed in this view --}}
    

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