Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some documentation around configuring asset finders #136

Closed
wants to merge 4 commits into from

Conversation

mjankowski
Copy link
Contributor

@mjankowski mjankowski commented Feb 9, 2022

I was attempting to use propshaft on a Rails 7 app, and based on #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.

@jamesmartin
Copy link
Owner

@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. 🤔

@mjankowski
Copy link
Contributor Author

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).

@jamesmartin
Copy link
Owner

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.

@mjankowski
Copy link
Contributor Author

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.

@xymbol
Copy link
Contributor

xymbol commented Oct 12, 2023

I ran into the same issue. #151

@jamesmartin jamesmartin deleted the branch jamesmartin:main September 30, 2024 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants