(Quick Reference)

8 Thymeleaf

Version: 8.0.0-M2

8 Thymeleaf

8.1 Introduction

Thymeleaf is a modern server-side Java template engine that emphasizes natural HTML templates that can be previewed in a browser by double-clicking, which is very helpful for independent work on UI templates (for example, by a designer) without the need for a running server. If you want to replace JSPs, Thymeleaf offers one of the most extensive sets of features to make such a transition easier.

HTML templates written in Thymeleaf still look and work like HTML, end with the file extension .html and reside in the app/views directory.

8.2 Installation

Add the grace-views-thymeleaf dependency to your build.gradle.

implementation "org.graceframework.views:grace-views-thymeleaf:8.0.0-M2"

8.3 Configuration

Thymeleaf template configuration can be altered with app/conf/application.yml.

For example:

grails:
    views:
        thymeleaf:
            enabled: true
spring:
    thymeleaf:
        ...

There are a number of spring.thymeleaf properties that can be set if you want to customize the Thymeleaf template engine.

See the Thymeleaf Templating Properties section of the Spring Boot Appendix.