~sgiath/spaceboy

2 2

Templates and Elixir Releases

Details
Message ID
<87mtj7fcjh.fsf@afontaine.ca>
DKIM signature
pass
Download raw message
Hello!

I'm just putting the finishing touches on the gemini arm of my blog
(using spaceboy), and I've hit a bit of a snag.

I deploy the application using a mix release, and I'm not sure how to
configure things so that the templates are included as part of the
release. I'm also not sure how to properly set the template root
directory to point at where the templates would be, as that is set at
compile time (right?).

I was looking at using mix's overlays¹, which would include them in the
release, but makes the setting of the template root tricky, I think.

Do anyone have any thoughts? Am I just missing something obvious? I know
phoenix goes through a whole macro set up to pre-compile the templates,
but that seems a bit heavy handed for this.

¹ https://hexdocs.pm/mix/Mix.Tasks.Release.html#module-overlays

--
Andrew Fontaine
afontaine.dev
Details
Message ID
<87iltsfxfo.fsf@afontaine.ca>
In-Reply-To
<87mtj7fcjh.fsf@afontaine.ca> (view parent)
DKIM signature
pass
Download raw message
Andrew Fontaine <andrew@afontaine.ca> writes:

> Hello!
>
> I'm just putting the finishing touches on the gemini arm of my blog
> (using spaceboy), and I've hit a bit of a snag.
>
> I deploy the application using a mix release, and I'm not sure how to
> configure things so that the templates are included as part of the
> release. I'm also not sure how to properly set the template root
> directory to point at where the templates would be, as that is set at
> compile time (right?).
>
> I was looking at using mix's overlays¹, which would include them in the
> release, but makes the setting of the template root tricky, I think.
>
> Do anyone have any thoughts? Am I just missing something obvious? I know
> phoenix goes through a whole macro set up to pre-compile the templates,
> but that seems a bit heavy handed for this.
>
> ¹ https://hexdocs.pm/mix/Mix.Tasks.Release.html#module-overlays

Looking at the docs, I found EEx.function_from_file/5. I'm only using 2
templates now so that seems simple enough!

Thanks for spaceboy!
--
Andrew Fontaine
afontaine.dev
Details
Message ID
<4242832.nUjQliOeXL@arch.sgiath.dev>
In-Reply-To
<87iltsfxfo.fsf@afontaine.ca> (view parent)
DKIM signature
pass
Download raw message
Hi Andrew!

> I'm just putting the finishing touches on the gemini arm of my blog
> (using spaceboy), and I've hit a bit of a snag.

Thanks for using Spaceboy :) as you can imagine it is really niche overlap - 
Elixir and Gemini - so I am really excited for every user :) 

> I deploy the application using a mix release, and I'm not sure how to
> configure things so that the templates are included as part of the
> release. I'm also not sure how to properly set the template root
> directory to point at where the templates would be, as that is set at
> compile time (right?).

I completely understand. I had the exact same problem when creating the 
example application which is part of the library repository. I was trying to 
copy it from the Phoenix but without success. And as you can see it is still 
not working in the example app too.

> I was looking at using mix's overlays¹, which would include them in the
> release, but makes the setting of the template root tricky, I think.

Seems like a good hint. I will try to investigate it.

> Looking at the docs, I found EEx.function_from_file/5. I'm only using 2
> templates now so that seems simple enough!

That is great you get it working! If you have any idea later on how to solve 
it generally feel free to send me diff I will include your the commit. In the 
mean-time I will try to figure something out too.

Have a nice day
-- 
Filip Vavera
https://sgiath.dev
GPG: 0x70F9C7DE34CB3BC8

Why is HTML email a security nightmare? See https://useplaintext.email/
Reply to thread Export thread (mbox)