Exactly
The following paragraphs show stuff that bypasses mix
’ environment system. Before you do apply this technique to your problem you should be sure, that there is no other solution! Also the snippet has been obfuscated a bit. Whoever uses this shall think about it.
And if you want to have automatic compilation of the docs in the publish stuff, you could do something like this:
def alias(_), do: []
def alias(:publish), do: [doc: [&doc_dev/0]]
def doc_dev(), do: System.cmd("mix", ["doc"], env: [{"MIX_ENV", "dev"}])
This should build your documentation by shelling out into a sub shell which has MIX_ENV
set to :dev
.
This is untested though. You need to test it by yourself.
1 Like