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

feat: auto enable experimental.processCSSVariables for tailwindcss v4 #506

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

qwerzl
Copy link
Member

@qwerzl qwerzl commented Feb 18, 2025

πŸ”— Linked issue

Closes #468.

❓ 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

Also enables test for Tailwind v4

@qwerzl qwerzl requested a review from danielroe as a code owner February 18, 2025 00:12
@codecov-commenter
Copy link

codecov-commenter commented Feb 18, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 80.59%. Comparing base (08d1e3d) to head (f4e7951).

Files with missing lines Patch % Lines
src/module.ts 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #506      +/-   ##
==========================================
+ Coverage   80.13%   80.59%   +0.46%     
==========================================
  Files          13       13              
  Lines        1067     1072       +5     
  Branches      282      293      +11     
==========================================
+ Hits          855      864       +9     
+ Misses        205      200       -5     
- Partials        7        8       +1     

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

@@ -129,6 +129,13 @@ export default defineNuxtModule<ModuleOptions>({
}
}

// Set `options.experimental.processCSSVariables` to `true` if TailwindCSS V4 is installed (which requires @tailwindcss/vite or @tailwindcss/postcss)
if (await findPath(await resolvePath('@tailwindcss/vite')) || await findPath(await resolvePath('@tailwindcss/postcss'))) {
Copy link
Member

@danielroe danielroe Feb 19, 2025

Choose a reason for hiding this comment

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

my only question is the potential perf cost of these resolutions - should we instead make a PR to the nuxt tailwind module enable the flag?

Copy link

Choose a reason for hiding this comment

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

The module still doesn't support v4 as there is an issue open where we were discussing how necessary it would be and which features should be kept now that v4 handles some of the features the module was tackling.

Relevant issues are nuxt-modules/tailwindcss#820 and nuxt-modules/tailwindcss#919

Copy link
Member Author

Choose a reason for hiding this comment

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

This would definitely be the most performant method but iirc the module hasn't supported tailwind v4 yet.

Copy link
Member Author

Choose a reason for hiding this comment

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

Or maybe, we could hook into prepare:types so the resolutions will only need to be ran once every time nuxt prepare is executed. I'll look into that later.

@qwerzl
Copy link
Member Author

qwerzl commented Feb 20, 2025

Marked as draft in favor of #515

@qwerzl qwerzl marked this pull request as draft February 20, 2025 08:09
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.

TailwindCSS v4
4 participants