darraghenright

darraghenright

Module aliases not working in colocated .holo templates

Been playing with Hologram for the first time this evening, and I am enjoying it a lot!

A couple of questions:

  1. Is the source code for the SVG Drawing Demo available online?
  2. Is it possible to reference aliased modules in colocated .holo templates?

The following didn’t work for me, but maybe I am not doing something right:

# in post_preview.ex
defmodule Blog.Components.PostPreview do
  use Hologram.Component
  alias Hologram.UI.Link

  prop :post, :map
end
<!-- in post_preview.holo -->
<article class="post-preview">
  <h2>{@post.title}</h2>
  <p>{@post.excerpt}</p>
  <Link to={Blog.Pages.PostPage, id: @post.id}>Read more</Link>
</article>

Using the fully qualified module name for the link worked as expected:

<Hologram.UI.Link to={Blog.Pages.PostPage, id: @post.id}>Read more</Hologram.UI.Link>

Anyway, this is a super interesting library, I’ll star and keep a close eye!

Marked As Solved

bartblast

bartblast

Creator of Hologram

@darraghenright, I’ve just pushed a fix for the alias resolving bug in colocated templates.
The fix is now in the dev branch, but since I have a new v0.6.0 minor release coming very soon, I’ll include this fix in that release rather than doing a patch release now.
In the meantime, if you’d like to use the fix right away, you can point to the specific commit in your mix.exs dependencies:

{:hologram, git: "https://github.com/bartblast/hologram.git", ref: "690868ac666ee50125079e9529129e6b6fda43da"}

Also Liked

darraghenright

darraghenright

Damn you’re good. Just sanity checked, works a treat!

bartblast

bartblast

Creator of Hologram

@darraghenright :slight_smile:

Here’s the most important part:
https://forum.elixirforum.net/t/hologram-v0-5-0-released/71830/11
There’s really nothing much more to it - the rest is just the layout. I plan to eventually add a “Demos” section to the website that will feature different demos from users with their source code."

Yes, it should work - I believe you discovered a bug. I’ll prioritize it.

Where Next?

Popular in Questions Top

Fl4m3Ph03n1x
Background Let’s assume I have a typical GenServer that receives messages as requests, does some operation in a DB and returns responses....
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
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
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
jc00ke
Expanding on this topic: https://forum.elixirforum.net/t/map-typespec-question/19217 Let’s say I have a map with required and optional k...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

Other popular topics Top

belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
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
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
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
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
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
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New

We're in Beta

About us Mission Statement