以与仅原型注释块类似的方式,所有三种文本模板模式(TEXT、JAVASCRIPT和CSS)都可以指示 Thymeleaf 删除特殊 /*[-*/ 和 /*-]*/ 标记之间的代码,
如下所示:
var x = 23; /*[- */ var msg = "This is shown only when executed statically!"; /* -]*/ var f = function() { ... }
将按以下方式执行:
var x = 23; var f = function() { ... }
或者,用于文本模式下:
... /*[- Note the user is obtained from the session, which must exist -]*/ Welcome [(${session.user.name})]! ...