polypush135
Nimble_publisher and recompiling while running iex or mix
I have made a simple static site using nimble publisher and followed along with the tut from fly.io Crafting your own Static Site Generator using Phoenix · The Phoenix Files
That said I have a simular build() function as from in the tut that just simply compiles the markdown files using earmark and so on with heex and then writes the to a given dir via File.write!
I’ve noticed that if I start a iex session or even run a cowboy server that if I call said build function while in IEx that it will not write anything different from when it started.
If I call recompile after I’ve made a change to a .md file but before I run said build() then it works. I assume this is because the other markdown files are still in memory even though I’ve edited a file, until I recompile that new edit wont be in memory. This is my assumption.
All of that is a non issue when calling from a mix task in a separate terminal session and build can be recalled and works as expected. Only time I see an unexpected behavor is when running the command from in iex or from a genserver that was watching files.
My question is: Is this assumption correct and what can I do about it?
Most Liked
mudasobwa
The issue is reenabling tasks was kinda flawed and had been fixed days ago. The following would do:
Enum.each(~w|compile compile.all compile.elixir|, &Mix.Task.reenable/1)
Mix.Task.run("site.build")
On trunk we now have Mix.Task.Compiler.reenable(compilers: compilers) which would do, too.
mudasobwa
v1.19 here is a PR Add `Mix.Tasks.Compile.reenable` by am-kantox · Pull Request #13771 · elixir-lang/elixir · GitHub merged.







