For some context, I am using a Ruby on Rails app with Vite Ruby. Now with the latest beta version this PR is included: Remove unused stylesheets when navigating. That solves the issue of overlapping styles when switching between layouts (when you remove the data-turbo-track="reload" attribute) but it also causes some issues:
- When the Vite dev server is on, during a Turbo navigation, all the styles disappear (probably because the stylesheets gets injected)
- In my case, many stimulus controllers are lazy loaded and when you import the styles of a library inside the stimulus controller for example
import '@splidejs/splide/dist/css/splide-core.min.css';, the styles also get removed.
Anyone has an idea for a solution for this? (I saw there is some patch for Trix here https://github.com/hotwired/turbo/pull/1133/files to add data-turbo-permanent but in many cases you have no control over the tags when they are injected by either tools or 3rd party libraries).
For some context, I am using a Ruby on Rails app with Vite Ruby. Now with the latest beta version this PR is included: Remove unused stylesheets when navigating. That solves the issue of overlapping styles when switching between layouts (when you remove the
data-turbo-track="reload"attribute) but it also causes some issues:import '@splidejs/splide/dist/css/splide-core.min.css';, the styles also get removed.Anyone has an idea for a solution for this? (I saw there is some patch for Trix here https://github.com/hotwired/turbo/pull/1133/files to add
data-turbo-permanentbut in many cases you have no control over the tags when they are injected by either tools or 3rd party libraries).