I'm using Hotwire Spark v0.1.12 with its basic support for Sprockets in my Rails 8 application, and while HTML reloading works perfectly, CSS reloading does not. It appears that when I change a CSS partial, Spark reloads that partial file instead of reloading the main manifest file (application.scss) that is actually served to the browser.
I have an application.scss file that includes several @import statements:
...
@import 'partials/*';
@import 'layouts/*';
...
To try to catch changes in the imported CSS files, I added the following configuration to my development.rb:
config.hotwire.spark.css_paths += %w[app/assets/stylesheets/layouts app/assets/stylesheets/partials]
config.hotwire.spark.css_extensions += %w[scss]
Now, when I edit a file like app/assets/stylesheets/layouts/frontpage.scss, I see log entries such as:
[ActionCable] Broadcasting to hotwire_spark: {:action=>:reload_css, :path=>"/frontpage.scss"}
Hotwire::Spark::Channel transmitting {"action"=>"reload_css", "path"=>"/frontpage.scss"} (via streamed from hotwire_spark)
This indicates that Spark is detecting the change, but it isn’t reloading the correct file (application.scss), which is what the browser uses. I’m looking for a solution to reload the full CSS bundle (i.e. the manifest file) when a subfile is changed.