Skip to content

Add support for hot reload of CSS files added with @StyleSheet #22465

@sissbruecker

Description

@sissbruecker

Describe your motivation

When using the legacy theme mechanism, I can modify any CSS file that is in the theme folder and get "hot reload", so a live update of the styles in the browser without having to refresh the page. This works both with or without Hotswap.

When adding a CSS file using @StyleSheet this does not work the same way:

  • Without Hotswap, but when running mvn spring-boot:run, it reloads the full page when changing styles. This is better than nothing, but it's not hot reload.
  • With Hotswap via the Vaadin IntelliJ plugin, nothing gets updated. I have to refresh the page manually after changing the styles.

In order to get developers to migrate from the legacy theme mechanism to using @StyleSheet we should ideally have feature parity between these two.

Describe the solution you'd like

Modifying a CSS file added with @StyleSheet should trigger hot reload, so that no page refresh is necessary. If hot reload is not feasible, Flow should at least force a page refresh.

Hot reload or page refresh should work the same way, regardless whether Hotswap is used or not.

One thing to keep in mind is that CSS files can import other CSS files using @import statements. All of those would have to be watched / updated.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    🏗 WIP

    Status

    🟢Ready to Go

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions