kalkatfyodor

kalkatfyodor

What is the difference between phoenix.css and app.css?

I don’t understand the difference between phoenix.css and app.css. In app.css I have phx-something classes. Why aren’t they in the phoenix.css file? Why isn’t app.css blank for my custom styling?

To be honest I have no idea where should I put my custom CSS styling, phoenix.css or app.css?

First Post!

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

app.css

Phoenix code will apply those classes to various DOM elements automatically, like when a live view page disconnects. However, it’s up to you what it should look like when those classes are applied. Thus, since it is “custom code” of a sort, it goes in app.css. When you generate a new project, Phoenix generates a good default for you, just as it does with lots of other code.

Most Liked

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

It’s best to hand out such comments sparingly :slight_smile:

@LostKobrakai I think has done an excellent explanation here that really gets at the heart of the goal. A good example today would be Bulma. Bulma is a very popular javascript free CSS framework. If you want to use bulma in a phoenix project it’s super easy: just delete phoenix.css and add the core bulma files and you’re done.

Notably: app.css will still contain a phx-disconnected definition, why? Because this is still a class you need to have a definition for regardless of whether you’re using the phoenix styles or not.

LostKobrakai

LostKobrakai

phoenix.css is the styling used so code generated by the phoenix generators doesn’t look ****. If you don’t intend to use the default UI you can delete the whole file as is. The LV related classes in app.css are indendend to be kept even if you scrap the default UI. They’re meant to be updated, but not removed, given they’re essential for the UX of LV pages. No need to search phoenix.css for essential vs non-essential pieces of css.

I can see a case being made that the alert classes should be part of phoenix.css, but tbh I also just delete them once I don’t use them anymore, just like phoenix.css.

Where Next?

Popular in Questions Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 131117 1222
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
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
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement