Fix assets not available in production #5082
Merged
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.
This pull request fixes the fetching of undigested files.
Since rails/sprockets-rails#49 (comment) rails does not support this by default and requires a custom task or gem. We already had such a task, which I updated.
Step 1 was to reproduce the bug on naos.
The relevant setting was
config.assets.compile = false
It is not an option to set this to true in production: https://stackoverflow.com/questions/8821864/config-assets-compile-true-in-rails-production-why-not
Step 2 was to fix the precompilation step for these files.
To fix this on naos I executed the
assets:nodigest
on naos.I updated this task, which was unused, to support glob variables and be rooted in the builds directory.
It is important to keep in mind that these files are not managed by sprockets, so we need to add the hash for cache bumping ourselves.
For this reason I updated the naming scheme in webpack and only copied the files that certainly received a hash by webpack.