Starlet9334
Hello there,
I am playing with Hologram. I’ve set up a fresh Phoenix project and followed the Hologram installation guide.
I have created a main_layout.holo like this
<head>
<title>{@page_title}</title>
<Hologram.UI.Runtime />
</head>
<body>
<slot />
</body>
At this stage, compilation works.
Now, I want to load the app’s style sheet and copied the corresponding line from root.html.heex like so
<head>
<title>{@page_title}</title>
<Hologram.UI.Runtime />
<link phx-track-static rel="stylesheet" href={~p"/assets/css/app.css"} />
</head>
<body>
<slot />
</body>
However, now the compilation fails:
Compiling 1 file (.ex)
error: undefined function sigil_p/2 (expected HologramTutorial.MainLayout to define such a function or for it to be imported, but none are available)
│
4 │ prop :page_title, :string
│ ^^^^^^^^^^^^^^^^^^^^^^^^^
│
└─ (hologram_tutorial 0.1.0) app/layouts/main_layout.ex:4: HologramTutorial.MainLayout.template/0
== Compilation error in file app/layouts/main_layout.ex ==
** (CompileError) app/layouts/main_layout.ex: cannot compile module HologramTutorial.MainLayout (errors have been logged)
Removing the <link> line makes the compilation work again.
For reference, this is my main_layout.ex
defmodule HologramTutorial.MainLayout do
use Hologram.Component
prop :page_title, :string
end
What might be going on here?
Thank you!
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted”
Version...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security











Showing Posts 1 to 3- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
phcurado
Try removing the sigil
~pfrom your template.or import the verified routes helper under your template file
Then you will be able to use the sigil ~p. More info on phoenix routing guide
Starlet9334
That worked, thank you!
bartblast
Thanks for the solution, @phcurado!
I wanted to add some clarification for anyone who might encounter a similar issue in the future.
You can’t use Phoenix routing-related functionality (like the
~psigil) in Hologram templates, as Hologram has a separate routing system due to fundamental architectural differences.Instead of:
<link phx-track-static rel="stylesheet" href={~p"/assets/css/app.css"} />The recommended approach in Hologram is:
<link rel="stylesheet" href={asset_path("assets/css/app.css")} />Why
asset_path/1? This helper function automatically appends a digest to the asset path for proper asset fingerprinting, which is essential for cache busting in production environments.While importing verified routes as @phcurado suggested will technically make the compilation error go away, using
asset_path/1is the idiomatic way to handle static assets in Hologram templates.