When one needs different modules to be compiled in different environments, it’d be better to explicitly define these module sets, instead of polluting the source code with conditionals.
For the modules to be available in :test only, the common approach is to create test/support folder, and modify your mix.exs in the following way:
I ended up going with the solution suggested by @andrejsm but I did give this a try out of curiosity and couldn’t get it to work. At first, I was getting a syntax error, so I switched to a multi-line if statement to see if that was the cause—that fixed the syntax error but resulted in the same compile error about the path function not being available.
Ah, okay. Thanks for the explanation. I gave that a try just to see (and for anyone else that stumbles across this thread) and you’re right, that works! Good to know.
Yea, I’m using both the local and test adapter already but needed a way to quickly, visually preview any email without having to trigger the sending. But thank you!
Right, yes. I am already using that feature of Swoosh. However, I wanted a slightly different solution where I could quickly preview any email without having to manually go through the user flows within my application (e.g. filling out forms). Unless, I’m completely missing something in the README…