Reputation: 1221
Let's say I have a variable cssStyles
which contains some css as String. I want to send it in my html file in this way
<style>
${cssStyles}
</style>
How can this be achieved with thymeleaf?
Thanks!
Upvotes: 0
Views: 731
Reputation: 804
At the very least you need to mark the style object that you'r using inline thymeleaf and use proper inline syntax. Below a mock of what I think might work.
See https://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html#inlining for more information on how to do thymeleaf inlining
<style th:inline="text">
[(${cssStyles})]
</style>
Upvotes: 1