wktdev

wktdev

Is there a command that Phoenix can be generated with that removes tailwind and only uses the most vanilla CSS?

I would like to be able to have a straight vanilla CSS setup. so that when I go to assets/css/app.css I can apply css to any element, including the body tag with no problems. FYI I am working in LiveView.

As it stands when I try to use assets/css/app.css I can’t seem to apply styles.

When I go to the statis/assets/app.css file it works as expected but I assume those will be overwritten during copile/server start up.

Thank you!

Showing Posts 1 to 7

mad

mad

Phoenix will soon have a new generator flag: --no-tailwind
https://github.com/phoenixframework/phoenix/blob/main/CHANGELOG.md#172-dev

abar

abar

Just in case someone stumbles upon this page like I did: if you have already generated a Phoenix application, and only later decided that you want to get rid of Tailwind, then you should do the following:

  • remove :tailwind from mix.exs
  • remove commands like tailwind.install, tailwind default from aliases in mix.exs (make sure to preserve esbuild-related commands, if you still plan to use that!)
  • remove @import "tailwindcss/... from app.css
  • delete file /assets/tailwind.config.js
  • remove block starting with config :tailwind from config.exs
  • remove tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]} from watchers inside dev.exs
  • run mix deps.clean --unlock --unused

Boom! Your app has been de-tailwindizied! Now all that remains is to remove god awful Tailwind classes in core_components.exs and fix layouts, but that is on you!

21
Post #2
finnillson

finnillson

Why are the core_components still being generated with tailwind classes when the --no-tailwind flag is used?

Look, I’m all for using what works for you but I feel like the framework should be a little more agnostic to what CSS “framework” someone might want to use.

The core_components should be generated with no CSS applied by default and should be as semantic as possible when it comes to HTML and what tags are used. The table component does not used attribute scope=“row” for example.

Personally, tailwind is a huge /fail/ and should not belong in the default generators. Put that stuff behind a flag.

16
Post #3
MrSidecar

MrSidecar

I’m really only chiming in to say that for the longest time I was afraid that I might be the only one having this major gripe.

When I started discovering Phoenix (back in the 1.4 days I think it was) and especially after LiveView, I was sure I had found my most loved framework of all time. Now they’ve jumped the Tailwind bandwagon and make it extremely hard/painful for us who actually remember the horrid days of inline styling, to opt out of if. I won’t share my rant-like opinion on Tailwind here, and really whatever floats anyone’s boat, but please put it behind a flag.

mlncn

mlncn

One more critical step!

Restore to assets/js/app.js the line:

import "../css/app.css"

or equivalent.

This is needed for esbuild to automatically bundle the CSS and write it to the same directory as your app.js (as documented in deps/esbuild/README.md).

At least for our project, after following the upgrade steps, that line had been removed, and although we did not need it for actually using the CSS we needed it for esbuild to do its work.

As for core_components being polluted with tailwind classes, i agree, but we are informed if we want to change the classes in core_components we need to override each one.

Josh

Josh

I started thinking about this after trying to remove Tailwind yesterday. I haven’t tried this yet, and it’s apparently the “wrong” way to use Tailwind, but it’s possible to create reusable classes with @apply. The page says:

If you start using @apply for everything, you are basically just writing CSS again…

…which is what some people want.

3 out of 4 of the disadvantages it lists aren’t really problems for people who don’t want to use Tailwind.

There’s also a Tailwind component library called daisyUI that looks like it might be based on that idea.

It isn’t a perfect solution, but I’m just trying to get the CSS out of the way as quickly as possible, and I don’t want to do things the Tailwind way because it’s slower and adds cognitive load.


Edit: I tried daisyUI with a Phoenix site. I’m not sure if this is useful to anyone, but if you add daisyUI and set styled to false, it will remove all of daisy’s design decisions and leave the site with the default reset-CSS Tailwind.

Then it looks like you can create your own CSS classes with raw CSS or @apply in the main CSS file. From this comment it sounds like using Tailwind’s @layer directive will automatically purge unused styles.

The end result is that I didn’t have to remove Tailwind, but it looks like I can use named classes and write normal CSS with it. I’m going to try using their components first, because it seems like a halfway point between Tailwind and something like Bootstrap.

jss

jss

I am really not that fond of Tailwind, unless I am building a very simple site.

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
kpanic
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
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
ChrisAmelia
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication): toke...
New
dillonoconnor
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New
thiagogsr
** (ArgumentError) expected :max_attempts to be a positive integer, got: {:@, [line: 10, column: 19], [{:max_attempts, [line: 10, column:...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews