Migration from Sprockets v3 to Propshaft

Hi everyone.

I’m working on a project that recently moved to Rails v8 and we’re using Sprockets v3. The idea is to migrate from Sprockets v3 to Propshaft straightaway. Is this possible?

Plan B was to first migrate from Sprockets v3 to Sprockets v4 and then migrate to Propshaft. But I wonder if we could skip that step.

These are some of the gems that we use that could affect the migration:

# Sprockets
gem "sprockets-es6"
gem "sprockets", "< 4"

# CSS
gem "sassc-rails"
gem "bootstrap", "4.6.2.1"
gem "bootstrap-datepicker-rails"
gem "owlcarousel-rails"

# JS
gem "jquery-rails"
gem "jquery-ui-rails"
gem "popper_js"

Also, I’ve created a new project in Rails 8 with Bootstrap and its installation differs from ours (via gemfile). Is this the way to go or can we still use the bootstrap gem?

Any help would be appreaciated.

Cheers, Agus.

I migrated from 4 to propshaft but don’t see why doing the same from 3 would be a problem.

Here’s the official step by step upgrade guide. Might be even easier because you don’t have to deal with webpacker, but make sure you read those sections and execute the steps that are possible.

1 Like

Hi Breno.

I want to thank you for your help.

I’ve ended up migrating from Sprockets v3 to Propshaft taking into consideration all the changes made in Sprockets v4 (see upgrade-3-to-4.md).

To sum up what I’ve done:

  • Removed deprecated assets (js, scss, etc.)
  • Reordered assets
  • Installed Propshaft following the UPGRADING guide
  • Installed sass through cssbundling-rails gem
  • Made sure that the scss were working fine
  • Installed esbuild through jsbundling-rails gem
  • Moved all js files from app/assets/javascript to app/javascript
  • Replaced all js related gems using yarn packages

Currently, I’m still migrating the js files but I’m happy that I managed to (which I believe) got through the hardest part.

Cheers,

Agus.

1 Like