ca1989
June 19, 2023, 7:27am
1
Hi all,
I have a Phoenix project PrjA with a path dependency DepA.
My goal is to be able to edit DepA and have the PrjA server to:
recompile
reload
run a mix task of DepA
1 is easy, using the :reloadable_apps option of Phoenix.CodeReloader.reload
2 is not so important
Regarding 3, I would love to run mix assets.build in DepA from PrjA.
My current solution is to run a task that rebuilds the assets in another shell from DepA.
I was wondering if there’s a way to avoid that.
Cheers
If this is for development than I think the easiest way is to use GitHub - falood/exsync: Yet another elixir reloader. · GitHub and set its reload_callback to a function that calls the mix task. You’ll also have to use a path dependency.
A generic solution is to use entr. GitHub - eradman/entr: Run arbitrary commands when files change · GitHub
It is a command line tool that lets you do anything when any files change.
For example, here is how I “re-create docs when any of the lib files change”:
find lib/ | entr -s 'mix format; mix docs -f html;'