13.4 文本解析器级别注释块:移除代码
类似于原型注释块,三种文本模版模式(TEXT
,JAVASCRIPT
与CSS
)都能够通知Thymeleaf移除特别的/*[- */
和/* -]*/
标记之间的代码,就像这样:
var x = 23;
/*[- */
var msg = "This is shown only when executed statically!";
/* -]*/
var f = function() {
...
或者这样,在TEXT
模式:
...
/*[- Note the user is obtained from the session, which must exist -]*/
Welcome [(${session.user.name})]!
...