0

By default we can apply styling to vaadin spring boot applications by annotating UI class with@Theme(themename). In my particular situation i annotated with @Theme(ValoTheme.THEME_NAME) ,but it's not over. Unfortunately, i didn't figured out how to set background for layout without dealing with css and extra files(And it seems the only solution unavoidable).

How to use both themes valotheme and custom (just for setting up background image) at the same time?

Many thanks for suggestions

Henri Kerola
  • 4,947
  • 1
  • 17
  • 19
Malakai
  • 3,011
  • 9
  • 35
  • 49

2 Answers2

1

You can extend a Vaadin theme in your own custom theme. If you extend the Valo theme in your theme, then you get Valo theme plus your own customization and additions:

@import "../valo/valo.scss";

@mixin mytheme {
  @include valo;

  // your own scss here
}
Henri Kerola
  • 4,947
  • 1
  • 17
  • 19
  • Uh, so i'm forced to switch all styling to css files... Seems very bad for me. However, i have generated maven project (which doesn't come with themes folder, like vaadin plugin generates) Where and how should i specify folder and what files are required? Please note that i prefer IntelliJ over Eclipse (converting whole project to eclipse, could be fatal for me) – Malakai Jan 08 '17 at 09:09
  • My bad asking for this question, found answer: https://vaadin.com/forum#!/thread/9721905 – Malakai Jan 08 '17 at 09:26
0

After enumorous attempts to get it done, i was forced to switch over css styling files. With that being said - i had to combine ValoTheme and my own "style".

For Spring Boot Devs: Initially Spring Boot won't generate any presets for custom styles (vaadin plugin for Eclipse and Netbeans does it), so you have to create folders manually: src/main/webapp/VAADIN/themes/<yourthemename>/ and place necessary css files there.

Quicktip:

Time-less consuming way:

  1. Make new vaadin project from here: Link
  2. Locate theme folder and copy-paste to your project
  3. Also do not forget to annotate UI with @Theme("myTheme")

Hope this helps someone

Malakai
  • 3,011
  • 9
  • 35
  • 49