naymspace / backpex

Backpex is a highly customizable administration panel for Phoenix LiveView applications.
https://backpex.live
MIT License
507 stars 30 forks source link

CSS & JS not loading #430

Closed azharmalik3 closed 3 months ago

azharmalik3 commented 3 months ago

Successfully ran the backpex into my project but it seems CSS not loading. Also, showing empty label buttons.

image

Also, it shows large icons.

image

Flo0807 commented 3 months ago

Hey, are Tailwind CSS and daisyUI installed correctly?

azharmalik3 commented 3 months ago

Hi, I installed it using the installation guide and I'm not sure if it installed correctly or not.

Do you know how I can verify?

fimac commented 3 months ago

I'm having a similar issue.

Screenshot 2024-07-02 at 11 59 32 am

I've been testing out adding Backpex (v0.5.1) into an existing project as we need an admin ui. But the existing project was built as a no html project, as it's just been used for API endpoints until now. So I have had to add in tailwind manually.

I was testing out kaffy and live admin as well, which all rendered ok. It might just be that i've messed something up with the install steps for daisy ui/tailwind config changes.

I'm going to test out the install with a fresh phoenix project and try installing Backpex into that to see if I can work out what i've missed.

fimac commented 3 months ago

I tested the install steps in a fresh phoenix project and I'm not having the issue. Just trying to figure out what i'm missing in my initial implementation.

Screenshot 2024-07-02 at 3 59 28 pm
fimac commented 3 months ago

My issue was due to missing this in the :browser pipeline in router.ex.

plug :put_root_layout, html: {YourAppWeb.Layouts, :root}

Adding that in, and my UI displays ok now.

Screenshot 2024-07-02 at 4 10 53 pm

I noticed the below error in the console in my browser, if you see that, maybe the above will fix your issue.

Screenshot 2024-07-02 at 4 11 39 pm
azharmalik3 commented 3 months ago

Yes, I noticed this and added this line in the router it starts loading layouts but still does not load CSS and JS files.

image

fimac commented 3 months ago

Does your static_paths function in YourAppWeb have assets included?

def static_paths, do: ~w(assets fonts images favicon.ico robots.txt)

azharmalik3 commented 3 months ago

Yes, I added assets in the static_paths in my AppWeb.

image

azharmalik3 commented 3 months ago

Thanks, The Problem is resolved.

I missed some configuration in the dev.ex for tailwind and esbuild.