Build assets for dependent phoenix application

I have an application (a nerves application actually) that depends on a phoenix application. Are there any patterns facilitate building the assets in this case? Is it generally required to precompile the assets and commit them into the git repository?

I’ve been hacking around it by cd'ing into the deps directory and running npm install inside there and modifying the phoenix application configuration to point to to the deps directory but this is hacky and generally it isn’t good to build things inside the deps directory.

I tried to search to see if anyone has already asked about this but it was quite hard to find a good search term and I don’t recall anyone asking on the forum before.

Here’s a link to the project: https://github.com/axelson/scenic-side-screen
And here’s the phoenix dependency: https://github.com/axelson/govee_phx

You could look at how phoenix/phoenix libraries like live_dashboard do it and it seems to boil down to shipping the compiled asset in priv/….

Other options can be:

  • A custom mix compiler in the phoenix project.
  • Aliasing compile.app (example)

Yeah I was hoping for an easier/built-in way if possible. Especially one that wouldn’t require committing the compiled assets.

Aliasing compile.app doesn’t seem to be enough on it’s own. A custom mix compiler seems like it might work but would be a bit annoying to implement.