docsite icon indicating copy to clipboard operation
docsite copied to clipboard

Update tailwind.md

Open leo030303 opened this issue 1 year ago • 4 comments

Fixed input.css file for tailwind version 4 see here https://github.com/DioxusLabs/dioxus/issues/3286#issuecomment-2518970010

leo030303 avatar Feb 06 '25 00:02 leo030303

  1. Is this still needed https://github.com/DioxusLabs/docsite/blob/84a6dfc386efab020def4f597d70126e689222fd/docs-src/0.6/src/cookbook/tailwind.md?plain=1#L35 or is it v0.5.* specific? Related to https://github.com/DioxusLabs/docsite/issues/435

  2. Is tailwind.config.js needed at all for v4?

mcmah309 avatar Feb 06 '25 19:02 mcmah309

Getting an error with these changes

Before:

@tailwind base;
@tailwind components;
@tailwind utilities;
root@c-nixos:/workspaces/voyver_website (master)$ npx tailwindcss -i ./input.css -o ./assets/tailwind.css --watch
≈ tailwindcss v4.0.4

Done in 131ms
^C

After:

@import "tailwindcss";
@source "./src/**/*.{rs,html,css}";
root@c-nixos:/workspaces/voyver_website (master)$ npx tailwindcss -i ./input.css -o ./assets/tailwind.css --watch
Error: Can't resolve 'tailwindcss' in '/workspaces/voyver_website'

edit:

Seems I needed to run

npm install tailwindcss @tailwindcss/cli

since global tailwind does not work with the import directive

mcmah309 avatar Feb 06 '25 19:02 mcmah309

  1. Is this still needed https://github.com/DioxusLabs/docsite/blob/84a6dfc386efab020def4f597d70126e689222fd/docs-src/0.6/src/cookbook/tailwind.md?plain=1#L35 or is it v0.5.* specific? Related to Missing Dist Folder #435

    1. Is tailwind.config.js needed at all for v4?
  1. I'm new to tailwind and Dioxus but I haven't seen the dist folder anywhere so presumably it's not necessary
  2. Again I'm unfamiliar with tailwind so not sure on that point, I just know the default tailwind setup with dx new doesn't work with v4, but replacing the input.css with that makes everything work

leo030303 avatar Feb 09 '25 17:02 leo030303

The dist folder was moved into the target folder at /target/dx/.... It shouldn't be required for tailwind classes unless you are dynamically generating tailwind class names which isn't recommended. If tailwind did include new classes based on the contents of the build output, dx would need to bundle again after the final classes file is created which would be slow

ealmloff avatar Feb 10 '25 15:02 ealmloff