[출처] http://stackoverflow.com/questions/15526140/how-to-add-source-code-comments-in-thymleaf-templates-that-dont-get-included-in
Version 2.1 is released so now u can upgrade your libraries and use comments in your code. With this version developers are able to use parser-level comment blocks:
<!--/* This code will be removed at thymeleaf parsing time! */-->
and prototype-only comment blocks:
<span>hello!</span>
<!--/*/
<div th:text="${...}">
</div>
/*/-->
<span>goodbye!</span>
Detailed explanation can be found in the official documentation here:http://www.thymeleaf.org/doc/html/Using-Thymeleaf.html#comments-and-blocks
Prior to version 2.1 you can do this
<th:block th:if="${false}"><!-- ignore me --></th:block>
Its very ugly (the th:block
needing a false th:if
) but works.
As mentioned Rafal Borowiec to comment block of HTML code you should use <!--/* something to comment*/--> 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');
}
|