How to add source code comments in Thymeleaf templates that don't get included in generated HTML?

前端 未结 5 1732
無奈伤痛
無奈伤痛 2021-02-03 18:14

I am using full stack Thymeleaf (spring mvc, security, layout dialect, webflow) in a mid-size web application.

Ok..now that we put so much of code in the html templates

5条回答
  •  情书的邮戳
    2021-02-03 18:47

    As mentioned Rafal Borowiec to comment block of HTML code you should use

    construction (see documentation).

    Also it is possible to comment/remove your javascript code using thymeleaf with

    /*[- something to comment -]*/ construction (see documentation). So you can annotate your js code without leaking any information

    /*[-
     *
     * Some information about function.
     *
     * -]*/
    function someFunction() {
        console.log('Hello world');
    }
    

提交回复
热议问题