sgardn

sgardn

Base page rendering and CSS broken after phoenix-storybook installation

Hi folks - I’m trying to get up and running with phoenix-storybook so I can have a local sandbox to learn a little about LiveView while building increasingly complicated components.

However, I’m seeing something broken where after installation, my app.css file no longer seems to affect the rendered homepage at all.

I’ve done a fair bit of spot checking and I can’t see what’s diverging about how the page could be working

  • the app.css file is completely unchanged (I’ve diffed it)
  • it is present as a resource locally when hitting the “/” route (either on the branch or on main)
  • it is included in the <head> tag in the page HTML

Does anyone have ideas about what could be broken about my rendering pipeline?

Here’s a PR / diff if that’s easiest to leaf through: feat: install storybook by sgardn · Pull Request #3 · sgardn/unprompted · GitHub

Version info:
Elixir: 1.16.0
Erlang: 25.3.2.8
Phoenix Storybook: 0.6.0

Here’s a test repo and branch that’s forkable if anyone wants to look around: https://github.com/sgardn/unprompted/tree/install-storybook

I’ve also created an issue here, where I will followup if I learn anything useful in the meantime: bug: setting up storybook breaks homepage rendering (CSS) · Issue #426 · phenixdigital/phoenix_storybook · GitHub

Marked As Solved

sgardn

sgardn

Ah thank you!

It looks like the solution is to add a CSS class generated based on the project name ("foo-web") to the <body> tag in the root HTML file (which is likely located here lib/#{your_app_name}/components/layouts/root.html.heex).

Though the number of lines of CSS happens to be the same (because the .important prefixer tailwind hack doesn’t do anything besides add a qualified CSS class), the contents do indeed differ.

My mistake was diffing the raw CSS at assets/css/app.css across branches - that file (for a newly created Phoenix app) just includes tailwind modules, and is 20 lines long. It and doesn’t actually represent the post processed CSS files (which I should have checked by downloading from dev tools :face_in_clouds:).

The commit containing updated generator instructions is here: generator now explains to set the sandbox class on the body tag · phenixdigital/phoenix_storybook@be3295f · GitHub

Also Liked

cblavier

cblavier

Hey @scott, I replied to you on GitHub!

Where Next?

Popular in Questions Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
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 I...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
Lily
In templates/appointment/index.html.eex: &lt;%= for appointment &lt;- @appointments do %&gt; &lt;tr&gt; &lt;td&gt;&lt;%= appoi...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call t...
New

Other popular topics Top

mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43806 214
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement