inline_svg
inline_svg copied to clipboard
Propshaft detection is load order dependant
The Propshaft integration works without configuration but depends on the entries' Gemfile
order. The detection works when the inline_svg
is listed after propshaft
.
The issue is caused by inline_svg
determining which adapter to use in an after_initialize
block and caching its value too early in the boot process when Propshaft is not ready. I found the call here:
https://github.com/jamesmartin/inline_svg/blob/1a1e2e0c1f3595a8e51a6a39727f357451d180c5/lib/inline_svg/railtie.rb#L19
Propshaft also uses an after_initialize
block to finalize its configuration, and Rails keeps track of railties in their load order. That's why swapping the gems is a workaround.
A proper fix would be to evaluate asset_finder
when called and once the assets are ready.