polypush135

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

mudasobwa

Creator of Cure

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

mudasobwa

Creator of Cure

v1.19 here is a PR Add `Mix.Tasks.Compile.reenable` by am-kantox · Pull Request #13771 · elixir-lang/elixir · GitHub merged.

Where Next?

Popular in Questions Top

albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
Phillipp
Hey, I have a NanoPi-M3 and try to install Elixir on their Ubuntu image. I followed the Raspberry Pi installation instructions from the ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement