ElMassimo / vite_ruby

⚡️ Vite.js in Ruby, bringing joy to your JavaScript experience
https://vite-ruby.netlify.app/
MIT License
1.28k stars 117 forks source link

Use Rails `load_defaults` for relevant gemfile in test runs #473

Closed mjankowski closed 1 month ago

mjankowski commented 3 months ago

All non-EOL'd Rails version at this point support a load_defaults method which can be used to tell Rails which version defaults to start with.

Some of the rails-version-gemfile test runs currently have deprecations about options that are either changing or going away or whatever, but these can generally be silenced by telling a given version to use it's own defaults, which is what this PR does.

Example of warning: https://github.com/ElMassimo/vite_ruby/actions/runs/9424262054/job/25964175006#step:6:9

The one oddity here (explained with inline comment in the diff) is the behavior of media: screen. In versions prior to 7.0, the media attribute in stylesheet tags would default to screen. That was changed in 7.0 to not be there by default, a behvaior which has a config option to enable/disable - https://github.com/rails/rails/commit/1280620767c6ce45576b893a8073d44590f4511c

I've chosen here to do the smallest diff approach - which is to just enable the option, which keeps the link method helper in helper_test working as-is (has a default media attribute). Another approach would be to leave the default off, and then modify that helper to default to no media, and only add one if passed in.

ElMassimo commented 1 month ago

Thanks Matt!