It delegates to Phoenix.Template.

On Mon, Oct 23, 2023 at 07:48 'Alexander Steppke' via elixir-lang-core <
elixir-lang-core@googlegroups.com> wrote:

> Thanks for the feedback, I've completely forgotten about
> `__mix_recompile__?`! @Jose: I couldn't find anything implementing it in
> LiveView or Phoenix though, is it implemented differently for
> `embed_templates`?
>
> On Thursday, October 19, 2023 at 11:07:41 AM UTC+2
> and...@andrewtimberlake.com wrote:
>
>> You can do this by creating a hash of the files and putting that in a
>> module attribute.
>> Then use __mix_recompile__?/0
>> <https://hexdocs.pm/mix/main/Mix.Tasks.Compile.Elixir.html#module-__mix_recompile__-0>
>> to hash the files again and compare the hashes.
>>
>> —Andrew
>>
>> On October 19, 2023, elixir-lang-core <elixir-l...@googlegroups.com>
>> wrote:
>>
>> We have a need to trigger recompilation of a module when any file inside
>> a directory is added or removed since we add the list of files at
>> compilation time as a module attribute which is used in guard statements.
>>
>> Something like
>>
>> ```
>> defmodule Example do
>>   @files File.ls!("some-path")
>> end
>> ```
>>
>> I think Phoenix's `embed_templates` would have to use a similar feature
>> if Phoenix didn't take care of triggering recompilation itself.
>>
>> Implementation wise I'd think it might probably suffice to set the
>> `digest` as the hash of the list of files (probably recursively?) in the
>> directory, but there might be better ways to do this.
>>
>> If there is another already existing way to achieve the same please let
>> me know, maybe I'm just missing something!
>>
>> Best regards, Alex.
>>
>>  --
>>  You received this message because you are subscribed to the Google
>> Groups "elixir-lang-core" group.
>>  To unsubscribe from this group and stop receiving emails from it, send
>> an email to elixir-lang-co...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elixir-lang-core/743e4012-af1b-437d-8277-97cd5bb302aan%40googlegroups.com
>> <https://groups.google.com/d/msgid/elixir-lang-core/743e4012-af1b-437d-8277-97cd5bb302aan%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elixir-lang-core+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/b6dc1896-3bb1-4658-8522-38d78c113fa5n%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/b6dc1896-3bb1-4658-8522-38d78c113fa5n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4KBpz%2BNkwys4-LxkZFObDXrU0ii2sgvTh3S%2BDc7oRGmow%40mail.gmail.com.

Reply via email to