Description
At the moment we are including the compiled static assets in the repository inside the priv/static
folder which should not be required. We do this because this files should be included when we publish a new release.
The downside is that when making changes we must remember to recompile the assets. Otherwise we risk including out of date assets when publishing a new release.
I took a look at how Oban Web does this and they have a mix release command that:
- Builds the assets
- Creates a new git tag and pushes it using the configured version
- Publish the new release to hex
This removes the need for keeping the compiled assets in the repository as they will be effectively compiled right before cutting the release, ensuring that they are always up to date.
Another thing that would be worth improving is how assets interact with the development server. At the moment we must run mix assets.watch
in a separate terminal along the dev server to ensure that they are updated.
As it turns out the Phoenix Playground has a endpoint_options
config that allows us to specify the watchers just like we do in a regular Phoenix project. If I understand this well, it would mean that the assets would automatically run along the dev server without us having to run them manually.