Where to place stylesheets in a vaadin 10 spring boot application

Hi Guys,

I am testing out a vaadin 10 application using spring boot. I used https://start.spring.io/ to generate a project. I followed the documentation of vaadin https://vaadin.com/docs/v10/flow/importing-dependencies/tutorial-include-css.html. There the following is stated:
“You can place style sheets and other static resources in any folder inside your WAR file except for /VAADIN which is reserved for framework internal use. VaadinServlet handles static resource requests if you have mapped it to / . Otherwise, the servlet container will take care of static resource requests.”

I created a stylesheet style.css and placed it under resources folder in my spring boot application. I referenced the stylesheet on my class using @StyleSheet("style.css"). I the classname of div has also been set. But when i run the application it seems my stylesheet is not being used.
What is the proper way of placing a stylesheet.

@StyleSheet("style.css")
public class MainView extends VerticalLayout {
	private TextField filter;
	private Button addNewBtn;

	public MainView() {
		TestDiv testDiv = new TestDiv();

		add(testDiv);
	}

	public class TestDiv extends Div {

		public TestDiv() {
			setText("TestDiv");
			setClassName("custom-cell");
		}

	}
}

17298377.png

If this works in same way as our own [Spring Boot app starter]
(https://vaadin.com/start/latest/project-base-spring), then the correct folder to place the stylesheet, would be resources/static/frontend/styles/.

Hi Tata,

Thanks for the advice. I tried the folder structure resources/static/frontend/styles/ and the stylesheet still didn’t show up. I then moved the stylesheet to resources/static/frontend/ and this worked.

Thank you.
17299604.png