On a new Rails 7.0.0.alpha2 app, it seems that autoprefixer-rails no longer activates if it appears before sprockets-rails in the Gemfile.
# gem 'autoprefixer-rails' # when above, silently fails to activate
gem 'sprockets-rails'
gem 'autoprefixer-rails' # when below, activates properly
So far I've confirmed that in railtie.rb, app.assets is nil not only during the original require, but also when the :setup_autoprefixer initializer is actually executed, which is why it fails to activate.
As to why app.assets is nil at that stage, I'm not completely sure, but it might be because sprockets-rails is now optional in Rails 7 and is itself initializing later in the boot process.
Hoping this provides a workaround for anyone else encountering the same issue and also provides a headstart on resolving it.
On a new Rails 7.0.0.alpha2 app, it seems that autoprefixer-rails no longer activates if it appears before sprockets-rails in the Gemfile.
So far I've confirmed that in railtie.rb,
app.assets
is nil not only during the originalrequire
, but also when the :setup_autoprefixer initializer is actually executed, which is why it fails to activate.As to whyapp.assets
is nil at that stage, I'm not completely sure, but it might be because sprockets-rails is now optional in Rails 7 and is itself initializing later in the boot process.Hoping this provides a workaround for anyone else encountering the same issue
and also provides a headstart on resolving it.Edit: see fix in PR #216