I finally solved my problem
Touching a view now recompiles only 1 file, and touching a controller recompiles 2 files (the controller and the endpoint) instead of 208 … (went from 30sec to 2sec)
What did I do?
- watched this video twice
- ran a gazillion times mix
xref graph --source lib/../my_controller.ex
andxref graph --sink lib/../router.ex
- also ran
fswatch _build -r | cat | grep .beam
to actually see what files are being recompiled - aliased
RouteHelpers
instead of importing them - removed any hard reference to
LayoutView
orRouter
in any of my plugs. I had to workaround this problem by usingModule.concat["MyApp.Router.Helpers"]
in my navigation plugs - had a weird dependency issue related to Coherence library when
coherence_routes
were inlined in my app main scope instead of its own dedicated scope - the last one still seems weird to me, but I also had to rewrite any
defdelegate
calls from views to other views into a classic function call
Hope it will help someone, and if you have any comment about my post, feel free!