inline_svg
inline_svg copied to clipboard
Add some documentation around configuring asset finders
I was attempting to use propshaft on a Rails 7 app, and based on https://github.com/jamesmartin/inline_svg/pull/134 I assumed (incorrectly) that inline_svg would "just work" within that setup, but I think it needs to be explicitly configured to use Propshaft.
If that's correct, this is an attempt to improve the docs in that regard. If not, I must have something wrong locally.
@mjankowski thanks for opening this PR! ✨
I assumed (incorrectly) that inline_svg would "just work" within that setup, but I think it needs to be explicitly configured to use Propshaft.
That's interesting. I use a basic Rails 7 test App for the automated integration testing on this gem, and that seems to work out of the box. That App is not explicitly configured to use PropShaft though. I wonder if that's why it seems to work. 🤔
Yeah - I believe you need to explicitly turn on propshaft either via a generator config option on a freshly generated app, or by adding the propshaft gem and removing sprockets if you are upgrading an old app. So, I suspect that your test app is successfully testing rails 7 integration, but not propshaft integration, if that makes sense (sprockets still works on 7).
Thanks for the feedback, I'll update the test App so we have a Rails 7 with and without Sprockets.
Regarding this gem's compatibility with Rails 7, it feels like we should be able to "detect" whether Sprockets or Propshaft is in use and configure the asset finder accordingly.
Yeah - I think you probably could detect it. That's what I assumed would be happening.
I could see any of these working...
- Look for the presence of certain gems being loaded or not, choose based on that
- Look for presence of certain ruby classes being present, choose based on that
- Some sort of conditional matrix of rails versions and gem/class presence
In those scenarios you'd need to have some default behavior to fall back on when multiple gems/classes/whatever were present. For example, a rails app which has Sprockets and Propshaft and Webpacker all present at the same time.
I ran into the same issue. https://github.com/jamesmartin/inline_svg/issues/151