Respect explicitly configured manifest path for modern Rails/Sprockets #434
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In our Rails 6/7 apps that use Sprockets 3/4 we configure manifest path explicitly like so:
Because of that
asset_sync
does not work properly because it does not pick up proper manifest, since it's located out of assets directory. Here is relevant code in sprockets source:https://github.com/rails/sprockets/blob/3.x/lib/sprockets/manifest.rb#L54-L63
So for us the solution was to explicitly path manifest path (which is nil unless defined explicitly) as a 3rd argument to
Sprockets::Manifest.new
which actually makes it work. This works for both Sprockets 3 and 4.We've been running this patch for years now. Hopefully this makes sense and this contribution gets accepted. There are no specs for manifest-related code so I was only able to add a spec for manifest path.
Also, looks like
manifest.yml
is not a thing from Rails 4: https://github.com/rails/sprockets-rails#changes-from-rails-3xSo maybe that is something to be cleaned up.