I looked through the Thymeleaf 2.0 documentation and I wasn't able to find an option to render the template output without whitespace. I'd like to reduce the filesize of the rendered HTML by stripping the whitespace.
The standard configuration does not do this, but you can create your own "writer" (implementation of ITemplateWriter) and then register your own template mode that uses it (ITemplateModeHandler, see the "Template Modes" section at the "Extending Thymeleaf" guide).
Having your own template mode will allow you to precisely define the way your results should be written back to HTML.
Have a look at the existing implementations at org.thymeleaf.templatewriter. You can probably use one of the existing implementations as a base.
Also, don't hesitate adding a feature request at our issue management system.
But one nice thing already (compared to, say, classic JSP) is that a neatly formatted source yields a neatly formatted output, since Thymeleaf works via attributes, rather than elements that can drag in extra newlines and such.
Hey, I found this link for same issyue https://github.com/thymeleaf/thymeleaf/issues/108.
Have anyone checked it? or there are some other solution for the same, actually I need Java Based configuration and the provided links has XML configuration. Please give me some solution for this.