Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update vite docs install for Vite v6 + Tailwind v4 #1024

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

PatMulligan
Copy link

@PatMulligan PatMulligan commented Jan 30, 2025

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Installing using VITE v6.0.11, it appears that postcss is no longer included in the vite installation

Also breaking changes related to Tailwind v4

Error: It looks like you're trying to use tailwindcss directly as a PostCSS plugin. The PostCSS plugin has mov ed to a separate package, so to continue using Tailwind CSS with PostCSS you'll need to install @tailwindcss/po stcss and update your PostCSS configuration.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@PatMulligan PatMulligan force-pushed the update-vite-docs-install branch from 707e4bc to ace155a Compare January 30, 2025 10:28
@PatMulligan
Copy link
Author

not sure if it's desirable to leave an option for a postcss.config.js or not! second commit removes it altogether

@PatMulligan
Copy link
Author

PatMulligan commented Jan 30, 2025

ah, not quite fixed. it's yelling at me for not having postcss now, anyone know the correct way to incorporate these packages?

reference for tailwind v4
https://tailwindcss.com/docs/upgrade-guide

@PatMulligan PatMulligan changed the title Update vite docs install Update vite docs install for Vite v6 + Tailwind v4 Jan 30, 2025
@PatMulligan
Copy link
Author

PatMulligan commented Jan 30, 2025

okay, updated the package installation according to the Tailwind V4 docs

There are two things that would require updating related to the npx shadcn-vue@latest init :

  1. the top should now be:
- @tailwind base;
- @tailwind components;
- @tailwind utilities;
+ @import "tailwindcss";
...
  1. And then it seems like the utility class border-border in the index.css is no longer recognized, will check the tailwind release notes

[vite] Internal server error: Cannot apply unknown utility class: border-border

edit: actually it doesn't seem to be correctly loading tailwindcss at all, utility classes aren't working nvm, seems fine

@almarzn
Copy link

almarzn commented Jan 30, 2025

And then it seems like the utility class border-border in the index.css is no longer recognized, will check the tailwind release notes

it is box-border now.

Anyway I'm trying to migrate as well, here are the things I also had to change:

  • The color theme customization is different now. You have to use --color-background instead of --background, with hsl() and inside a @theme directive
  • The primary etc color don't seem to be working on buttons, need to investigate

@PatMulligan
Copy link
Author

PatMulligan commented Jan 30, 2025

cool thx!

according to tailwindlabs/tailwindcss#15778 (comment) , @apply should probably just be junked all together

Copy link
Collaborator

@sadeghbarati sadeghbarati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please keep the TailwindCSS v3 installation too?

But make TailwindCSS v4 bolder (which already is, I meant to keep it on top)

@clementmas
Copy link

Does the style.css file have to be updated to support Tailwind v4 or is it not affected?

@titou26140
Copy link

Tailwind v4 is not yet supported as config is now write in css main file and not in a tailwind.config.js

@PatMulligan
Copy link
Author

PatMulligan commented Feb 19, 2025

Does the style.css file have to be updated to support Tailwind v4 or is it not affected?

Using my css sheet, one of the things I had to do for proper functioning was to have the following up top (note this replaces the typical v3 import statements).

@import "tailwindcss";
@config "@/tailwind.config.js";
...

@@ -27,62 +27,23 @@ npm create vite@latest my-vue-app -- --template vue-ts

Install `tailwindcss` and its peer dependencies, then generate your `tailwind.config.js` and configure `postcss` plugins
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I understand they removed the config file.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christianfullstack
Copy link

Makes it sense to wait or should i update now to Tailwind 4 for a Production Project ?

@andrerfcsantos
Copy link

Does the style.css file have to be updated to support Tailwind v4 or is it not affected?

Using my css sheet, one of the things I had to do for proper functioning was to have the following up top (note this replaces the typical v3 import statements).

@import "tailwindcss";
@config "@/tailwind.config.js";
...

What should tailwind.config.js contain in this case? I was under the impression that the tailwind config is something that should be optional now.

@ssiyad
Copy link

ssiyad commented Mar 7, 2025

"JavaScript config files are still supported for backward compatibility, but they are no longer detected automatically in v4. If you still need to use a JavaScript config file, you can load it explicitly using the @config directive"

@andrerfcsantos https://tailwindcss.com/docs/upgrade-guide#using-a-javascript-config-file

@andrerfcsantos
Copy link

@ssiyad I get that, I'm just wondering what the contents of tailwind.config.js should be in this case. The same as the original instructions?

@ssiyad
Copy link

ssiyad commented Mar 8, 2025

Nothing, right? Our config should go in a separate css file and be imported in tailwind.css I think.

@PatMulligan PatMulligan force-pushed the update-vite-docs-install branch from 984194a to f0603c2 Compare March 10, 2025 23:23
@PatMulligan
Copy link
Author

Makes it sense to wait or should i update now to Tailwind 4 for a Production Project ?

I wouldn't recommend anyone use this for production yet until shadcn is updated.

If you want you can use the upgrade guide script which does indeed get rid of tailwind.config.js and imports everything into the css file.

As a result, adding in shadcn components won't work because it looks for the config file.

@andrerfcsantos
Copy link

Nothing, right? Our config should go in a separate css file and be imported in tailwind.css I think.

I put the original config, which should be redundant and have no conflicts with other configs. But after that, I ran into #1090. After I tricked the script into believing there was a valid config, the styles on the page didn't seem correct.

In the end I just gave up and I'll wait for proper support for v4. I see there's already a PR lined up. Shadcn for React already supports Tailwind v4, so starting this project in React and not in Vue is also something I'm considering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants