Skip to content

Improve CSS file management in Vaadin project #23657

@TatuLund

Description

@TatuLund

Describe your motivation

Our new recommended way to load CSS is to use @StyleSheet annotation in Vaadin 25 and place CSS in resources. This adds a new inconvenience, as depending on project the resource folder is not the same. E.g. with JAR-packaged Spring Project the correct place of @StyleSheet("styles/main.css") would be "src/main/resources/META-INF/resources/styles/main.css", but if your application is WAR-packaged, the place is "src/main/resources/styles/main.css". When considering all possibilities, there are other possible places for the files. This makes DX bad, adds confusion amongst our users.

Describe the solution you'd like

Ideally There should be one way to place the CSS files that always works regardless you use Spring Boot or not, and packaging type.

E.g. we could establish convention to have folder "styles" in the root of the project and our vaadin-maven-plugin would move it in the resulting package into correct place.

Describe alternatives you've considered

Add build time validation in vaadin-maven-plugin, which checks that correct paths are used and fail build with clear and intuitive message.

Additional context

The main goal is to make the configuration automatic. With Vaadin 24 and theme folder this problem does exists.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    🪵Product backlog

    Status

    Needs Design

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions