Default CSS for server-side Component or Addon

I’ve written a few server-side components that I want to package up and share within my organization. These components extend Vaadin components or implement CustomComponent. At construction, they add a style name to the component. What I can’t figure out is how to bundle my default CSS for the component in the addon JAR so it gets referenced.

I know that with a custom GWT component I can use the tag in the widgetset file, but for server-side components I don’t have a widgetset file.

Is there some way to package my stylesheet with server-side components so consumers of the JAR can easily reference it in their theme? I’m using Vaadin 7beta8 but I’m assuming the approach hasn’t changed between 6 and 7.

-mike

I figured out that it will work if I put the CSS files in /VAADIN/ in the library JAR and then tell consumers of the library to add this line to their styles.css:

@import “…/…/shared-component-style.css”;

It appears that the VaadinServlet will attempt to find any resource requested under /VAADIN/ using getResourceAsStream so it finds these styles in the classpath. I’m not sure if it is the best way to do it, but it gets the job done and now I can have shared, reusable server-side components and styles across the organization.

-mike