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

fix(module): handle tailwindcss import without theme(static) #3630

Merged
merged 11 commits into from
Mar 20, 2025

Conversation

sandros94
Copy link
Member

πŸ”— Linked issue

Reference #3374, 85b45f6

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ 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

Since Tailwindcss 4.0.8 it has been required to add theme(static) to all the tailwinds imports. The underline issue is that in the color's plugin we are not able to inform tailwind which color are being added in the page head.

The solution I came with is to take advantage of var() fallback and populate it directly with upstream's oklch string. The final output allows to both override the color with the local assets/css/main.css as well as safely fallback to an empty string if an unsupported color is provided.

The final style output looks something like:

:root {
  --ui-color-primary-50: var(--color-green-50, oklch(0.982 0.018 155.826));
  --ui-color-primary-100: var(--color-green-100, oklch(0.962 0.044 156.743));
  --ui-color-primary-200: var(--color-green-200, oklch(0.925 0.084 155.995));
// ....
  --ui-color-neutral-900: var(--color-slate-900, oklch(0.208 0.042 265.755));
  --ui-color-neutral-950: var(--color-slate-950, oklch(0.129 0.042 264.695));
}

πŸ“ Checklist

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

@sandros94 sandros94 added bug Something isn't working v3 #1289 labels Mar 20, 2025
@sandros94 sandros94 self-assigned this Mar 20, 2025
Copy link

pkg-pr-new bot commented Mar 20, 2025 β€’

npm i https://pkg.pr.new/@nuxt/ui@3630

commit: 465d78d

Copy link
Contributor

nuxthub-admin bot commented Mar 20, 2025 β€’

βœ… Deployed ui3

Deployed ui3 465d78d to preview

πŸ”— fix-theme-static.ui-6q2.pages.dev
πŸ“Œ 8a271683.ui-6q2.pages.dev
πŸ“±
View QR Code QR code linking to deployment URL.

πŸ“‹ View deployment logs

@benjamincanac benjamincanac changed the title fix: stop requiring theme(static) fix(module): handle tailwindcss import without theme(static) Mar 20, 2025
@benjamincanac benjamincanac removed the bug Something isn't working label Mar 20, 2025
@benjamincanac benjamincanac merged commit ecff9ab into v3 Mar 20, 2025
4 checks passed
@benjamincanac benjamincanac deleted the fix-theme-static branch March 20, 2025 14:53
@benjamincanac
Copy link
Member

Awesome work @sandros94! Thanks a lot β™₯️

@benjamincanac benjamincanac mentioned this pull request Mar 21, 2025
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3 #1289
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants