Vaadin 23: different themes for different deliveries

206 views Asked by At

https://vaadin.com/docs/latest/ds/customization/custom-theme describes how to use a custom theme in Vaadin 23. The current theme is selected by writing its name into the Theme annotation like this: @Theme("my-theme").

The system I'm currently developing is always the same Java code but with different styles/themes. That means that system A for customer cA uses corporate design/theme dA and system B for customer cB uses corporate design/theme dB.

How is this (theming different deliveries) done with the theme mechanism?

(I'm not talking about switching the theme at run-time (which would be nice). I know that Vaadin talks about this limitation: The theme cannot be switched run-time.)

Idea 1: exchange the content theme/my-theme directory at delivery time. Feels not intended, because in this case there was no need for an individual theme-directory-name...

Idea 2: exchange the value at the Theme annotation at delivery time. Also feels not intended.

Idea 3: maybe there is a start parameter for that? I guess not, because it would have to change the (constant) value of the Theme annotation...

1

There are 1 answers

0
Tatu Lund On BEST ANSWER

For build time usage of different themes, one of the intended methods is to package the them as jar module and use it as a dependency in your application project. This will allow you to use different theme jars by configuring maven profiles per each customer.