collect-assets icon indicating copy to clipboard operation
collect-assets copied to clipboard

Support for the Tailwind v4

Open RustGrow opened this issue 1 year ago • 9 comments

Version 4 of tailwind css will replace version 3 sooner or later.

  1. Right now using version 4 completely breaks manganis.
  2. When cargo check finishes the tailwind 4 server terminates.
  3. It is impossible to use Tailwind CDN because it does not exist.

Steps to reproduce the behavior: Using the CLI

npm install tailwindcss@next @tailwindcss/cli@next Next, import Tailwind in your input.css file: @import "tailwindcss";

npx @tailwindcss/cli@next -i ./input.css -o ./assets/tailwind.css --watch

repo

https://github.com/user-attachments/assets/c93a6c83-83c5-4b39-8988-53ef4faba893

Dioxus version: 0.6.0-alpha.2 Rust version: rustc 1.81.0 OS info: Win11 App platform: web

RustGrow avatar Sep 29 '24 14:09 RustGrow

Now v4 is the default for new installations!

mfurseman avatar Jan 23 '25 09:01 mfurseman

tailwind v4 seems to be working, but not fully, testing some classes like setting text size and font styles are not working for me, I'm not sure why.

rrrrigel avatar Jan 25 '25 07:01 rrrrigel

tailwind v4 seems to be working, but not fully, testing some classes like setting text size and font styles are not working for me, I'm not sure why.

Not sure if you have the same problem as me but i got my setup working by changing

@tailwind base; @tailwind components; @tailwind utilities;

to

@import "tailwindcss";

in my input.css

and running

npx @tailwindcss/cli [...]

instead of

npx tailwindcss [...]

It is documented this way on the tailwind v4 doc for the cli version

tsager25 avatar Feb 10 '25 22:02 tsager25

Thanks @tsager25! This helped me!

sverro2 avatar Mar 12 '25 09:03 sverro2

It was very confusing to init a new application with tailwind and it not working. Thanks for workaround.

tsr8 avatar Mar 13 '25 20:03 tsr8

tailwind v4 seems to be working, but not fully, testing some classes like setting text size and font styles are not working for me, I'm not sure why.

Not sure if you have the same problem as me but i got my setup working by changing

@tailwind base; @tailwind components; @tailwind utilities;

to

@import "tailwindcss";

in my input.css

and running

npx @tailwindcss/cli [...]

instead of

npx tailwindcss [...]

It is documented this way on the tailwind v4 doc for the cli version

Although there is no error, the vast majority of classes in tailwindss do not work

zhuwei avatar May 06 '25 10:05 zhuwei

Can you give an example of classes that don't work?? For me so far I haven't encountered any. Or I am extremely lucky? Isn't it just a matter of the already existing CSS files (created in the dx new project) overriding the tailwind classes?

I do use Tailwind 4 atm, in combination with Dioxus

sverro2 avatar May 07 '25 14:05 sverro2

The steps that I used to get Tailwind v4.1.8 working with Dioxus v0.6.3 were:

  1. npm install tailwindcss
  2. Change your input.css to contain nothing other than @import "tailwindcss";
  3. And the new watch command is as follows: npx @tailwindcss/cli -i ./input.css -o ./assets/tailwind.css --watch

Legorooj avatar May 29 '25 19:05 Legorooj

@Legorooj VM13:3 Not allowed to load local resource: file:///F:/Temp/rust/test/src/assets/tailwind.css

zhuwei avatar Jun 26 '25 07:06 zhuwei