I’m trying to create a simple theme (using Chameleon and some custom css and images, etc), which I’ve done.
The problem is I want to wrap it up in a maven project and reference from other Vaadin projects as a dependency, so I can theme all my Vaadin apps the same way – or even better have it as a dependency of the parent project so that the whole app gets styled the same way and I can re-skin it for different customers.
I’m not sure how to package and deploy the theme project so that it will be usable from the other projects? Should I make it into a war project – but then how do the other projects ‘get at it’? They’ll be looking for the themes under their own VAADIN/themes directories – rather than copying it there (somehow), how could I just have them reference one single copy?
I’ve had the same problem. I solved it by using war overlays.
I have a base theme in the parent project which is extended in clients’ configuration projects. The configuration project simply uses the war as a runtime dependency and the parent project’s files are overlaid, as explained here.
Just add the dependency in the client’s project:
and import the parent project’s styles in the client’s theme’s styles.css file:
and add the client’s styles.
If you need to use the classes of the parent project, you can set the
attachClassesproperty true in the maven-war-plugin configuration and also attach the sources by using maven-source-plugin if you need them for debugging:and include them in your client’s project: