Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Where to put css templates in thymeleaf?


Asked by Rosalia Quinn on Dec 13, 2021 CSS



Now, as a reminder, Thymeleaf is a templating library that can be easily integrated with Spring Boot applications. By default, Thymeleaf expects us to place those templates in the src/main/resources/templates folder. We can create subfolders, so we'll be using a subfolder called cssandjs for this example.
In respect to this,
The JAVASCRIPT template mode will allow the processing of JavaScript files in a Thymeleaf application. This means being able to use model data inside JavaScript files in the same way it can be done in HTML files, but with JavaScript-specific integrations such as specialized escaping or natural scripting.
Also Know, 3.1. Directory Structure Now, as a reminder, Thymeleaf is a templating library that can be easily integrated with Spring Boot applications. By default, Thymeleaf expects us to place those templates in the src/main/resources/templates folder.
In this manner,
Thymeleaf can select an arbitrary section of a page as a fragment (even a page living on an external server) by means of its Markup Selector syntax, similar to XPath expressions, CSS or jQuery selectors. The above code will include a section with class="description" from thymeleaf.org.
Besides,
Because I am using Javalin, all my Thymeleaf template resolvers use ClassLoaderTemplateResolver - but for different types of web application (for example, a traditional Tomcat webapp), different resolvers could be used - most notably, the ServletContextTemplateResolver. My class has three template resolvers, one each for HTML, CSS, and JS files.