Hi ,
My personal website is powered by Phoenix and Elixir, and I started working on adding support for generating the blog posts’ open graph images dynamically.
I added a new task, mix phx.gen.open_graph
, that I can run as part of deployment to generate the images for all the blog posts, but I’m struggling to integrate image generation into development. The solution I was tinkering with was doing something similar to Tailwind or ESBuild — having a watcher that generates the image for the blog post that has changed. I’m trying to do that with a GenServer that subscribes to file change events, but the callbacks are not getting invoked at all. I had a look at Tailwind and ESBuild’s implementation and I was a bit confused seeng that there’s an install_and_run
method that’s invoked from the watchers configuration, and the module itself is also an Application
that’s started along with the app. What am I doing wrong?
Thanks in advance