Reputation: 12305
I have a few Vaadin 22 + Spring Boot applications for which I'd like to create a .jar library with some components (mostly simple java components composed of standard Vaadin Flow components) that can be shared and reused in multiple apps.
Each component will have some dedicated CSS (global, not shadow DOM).
Normally, when the Spring Boot service defines its own components, such styles reside in the /frontend folder and the components can import them using the @CssImport
annotation.
How should I package the .jar library so that the components in that library can use @CssImport
to import CSS that also comes from the same .jar library?
Upvotes: 1
Views: 163
Reputation: 37073
For @CssImport("./my-styles/styles.css")
, place the file in
src/main/resources/META-INF/resources/frontend/my-styles/styles.css
of your
add-on, or make sure, that the file ends up on the class-path under
/META-INF/resources/frontend/my-styles/styles.css
.
Source: "Loading Resources/Resource Cheat Sheet/Table 3: in add-ons"
Upvotes: 5