Read assets during compilation #32
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.
We are getting reports that when a mix release is deployed to production the dashboard breaks because it can't find the CSS and JS files.
I've built a mix release locally and it works well. It only fails when deployed (for example to fly.io). This has been confirmed in the error report.
Interestingly enough, when I deployed the release to fly.io I saw that the
priv/folder is not present. I am extremely confused as of why this happens as I see that other dependencies such asphoenixdo include that folder. I reviewed themix.exsfrom both projects and I couldn't find what would cause this difference.Anyway, I was able to fix this problem by reading the CSS and JS files on compilation. Since those files are included in the package, we can be confident that they exist at that point.
Since the static files were present in
.gitignoreI was having trouble when doing tests as I was pointing directly to the GitHub repository. Since Mix supports getting dependencies from GitHub directly I had to include those files in the repository. Otherwise people won't be able to run the error tracker pointing to a particular branch or commit.It may be a good idea to set a pre-commit hook to ensure that they are always up to date.
Fixes #30