Skip to content

Add default support for the Propshaft asset pipeline #61

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

Merged
merged 5 commits into from
Nov 23, 2021

Conversation

rmacklin
Copy link
Contributor

@rmacklin rmacklin commented Oct 31, 2021

Follow-up to #60

Closes #42

New rails 7 applications can be generated with Propshaft as an alternative asset pipeline to Sprockets: rails/rails#43261. Per #42 (comment), we want importmap-rails to work out of the box with either of those asset pipeline options, so we'll automatically add Propshaft::MissingAssetError to the rescuable_asset_errors if Propshaft is detected. This allows the test suite to pass when run against an application that uses Propshaft instead of Sprockets. To that end, we've extended the CI matrix to also run our test suite continuously against a rails 7 application that uses Propshaft.

@rafaelfranca
Copy link
Member

Can you rebase and make it ready to review?

@rmacklin
Copy link
Contributor Author

rmacklin commented Nov 5, 2021

Okay, I rebased the branch, but I still haven't addressed the test coverage issue. I did notice we have this:

rails_version = ENV["RAILS_VERSION"] || "6.1.0"
gem "rails", "~> #{rails_version}"

although it doesn't currently appear to be used - we aren't using the CI matrix to test against different rails versions. Perhaps I should start by adding that, and then I can follow up here by adding a conditional in the Gemfile that swaps out sprockets-rails for propshaft and then extend the CI matrix to exercise that as well.

@rmacklin
Copy link
Contributor Author

rmacklin commented Nov 21, 2021

I've opened #73 to expand the CI matrix to test against multiple versions of rails. If that looks good, I'll update this PR accordingly and then mark it ready for review.

Rails 7 will formally support multiple asset pipelines, making sprockets
optional:
rails/rails@fb1ab34
Since our rails 7 gemfile is still using sprockets, let's rename it to
clarify that, which will also make the setup clearer when we add a
separate `rails_7_propshaft` gemfile.
(generated via `bundle exec appraisal install`)

We'll use this new Gemfile to test importmap-rails against a rails 7
application using the propshaft asset pipeline (instead of
sprockets-rails) on CI.
Since rails 7 has made sprockets optional in
rails/rails@fb1ab34
our test app should support running without sprockets. This will allow
us to test importmap-rails with an alternative asset pipeline such as
propshaft.
We'll automatically add `Propshaft::MissingAssetError` to the
`rescuable_asset_errors` if `Propshaft` is detected. This allows the
test suite to pass when run against an application that uses propshaft
instead of sprockets.
New rails 7 applications can be generated with propshaft as an
alternative asset pipeline to sprockets:
rails/rails@fb1ab34
Since we want importmap-rails to work out of the box with either of
those asset pipeline options, we'll run our test suite continuously
against both.
@rmacklin rmacklin changed the title WIP Add default support for Propshaft::MissingAssetError Add default support for the Propshaft asset pipeline Nov 22, 2021
@rmacklin rmacklin marked this pull request as ready for review November 22, 2021 17:43
@rmacklin
Copy link
Contributor Author

@rafaelfranca Done!

@dhh dhh merged commit 3406286 into rails:main Nov 23, 2021
@rmacklin rmacklin deleted the support-propshaft branch November 23, 2021 17:20
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.

Intentions for integrating with Propshaft?
3 participants