spring boot - Vaadin custom css - customizing themes -


i'm having issue using custom theme. i'm using spring boot + vaadin 8 , intellij idea + gradle. i've created file: src/main/webapp/vaadin/themes/mytheme/styles.css

@import "../valo/styles.css"; .my-split { background: #a983ff; } 

i've added @theme("mytheme") ui class.

i've set style name on component: gridssplitpane.addstylename("my-split");

and when run app seems mytheme gets loaded because background changed correctly else has no css styling - if import didn't work: @import "../valo/styles.css"

what missing here?

i've seen information theme needs compiled somehow. can me compile gradle + intellij idea? required plain css customizations mine?

when use @theme("valo") instead - loaded correctly, i'm guessing valo theme files loaded correctly from: vaadin-themes-8.1.0.jar!/vaadin/themes/valo/...

build.gradle

buildscript {     ext { springbootversion = '1.5.6.release' }     repositories { mavencentral() }     dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springbootversion}") } }  apply plugin: 'java' apply plugin: 'org.springframework.boot'  version = '0.0.1-snapshot' sourcecompatibility = 1.8  repositories { mavencentral() }  ext { vaadinversion = '8.1.0' }  dependencies {     compile('com.vaadin:vaadin-spring-boot-starter')      compile("org.springframework.boot:spring-boot-starter-logging")     compile('org.springframework.boot:spring-boot-starter-web')     testcompile('org.springframework.boot:spring-boot-starter-test') }  dependencymanagement {     imports { mavenbom "com.vaadin:vaadin-bom:${vaadinversion}" } } 

appmain.java

package example;  import org.springframework.boot.springapplication; import org.springframework.boot.autoconfigure.springbootapplication;  @springbootapplication public class appmain {     public static void main(string[] args) {         springapplication.run(appmain.class, args);     } } 

myui.java

package example;  import com.vaadin.annotations.theme; import com.vaadin.server.vaadinrequest; import com.vaadin.spring.annotation.springui; import com.vaadin.ui.label; import com.vaadin.ui.ui; import com.vaadin.ui.verticallayout;  @theme("mytheme") @springui(path = "/ui") public class myui extends ui {     @override     protected void init(vaadinrequest request) {         label label = new label("customizing theme.");         label.setstylename("my-label");          verticallayout root = new verticallayout();         root.addcomponent(label);         root.setsizefull();         setcontent(root);     } } 

you close working. use custom scss theme, put following in styles.scss:

@import "../valo/valo";  .mytheme {     @include valo; } 

the basic difference content mentioned in comments way include valo in theme.

edit

your original question css theme. far can see, css themes shouldn't work including valo because styles prefixed .valo css selector , switching custom theme add css class mytheme instead of default valo main div element. tested add valo css class in final html (firefox inspector) shows styles expected. feels vaadin bug. so, recommend using scss themes have more features css.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -