3

recently I've switched our CSS styles for our application and components to theme (added in vaadin 14.6). Right now I'm looking for an alternative to include parameter of @CssImport annotation.

@CssImport(value = "./styles/custom-charts.css", themeFor = "vaadin-chart", include = "vaadin-chart-default-theme")

We have some style changes for vaadin-chart but we needed to include original vaadin-chart-default-theme.

Is there a way to achieve the same with the Theme support?

Thank you

Anna Koskinen
  • 1,362
  • 3
  • 22
Lipisak
  • 33
  • 3

1 Answers1

4

As far as I know, this isn't possible at the moment, for the default Charts theme.

If you need to reuse some style sheet across components, you should be able to use the standard @import declaration.

For the Charts default theme, you probably have to use the existing @CssImport or the JavaScript registerStyles() method (from @vaadin/themeable-mixin).

Jouni
  • 2,830
  • 15
  • 12
  • Yes I have used the @CssImport and it works. So now it's the last occurrence of this annotation in our code. Thank you for this answer. – Lipisak May 18 '21 at 07:23
  • 1
    One more thing I wanted to add: the way the default chart theme works is different from all other components, and I think we should change that in the future, so that it would not get replaced overwritten when you add your own customizations on top of it. – Jouni May 20 '21 at 06:31